﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Reflection;
using System.IO;
using System.Configuration;

using Microsoft.VisualBasic.Devices;
using DevExpress.XtraNavBar;
using DevExpress.XtraTreeList;
using THSERP.BaseProvider;
using THSLib;

namespace THSERP
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class ModuleParentScreen : DevExpress.XtraEditors.XtraForm
    {
        public BaseModuleERP module;
        public static int countParentScreenActive = 0;
        private int TreeListHotTrackID = -1;

        #region Controls variables

        private System.ComponentModel.IContainer components;

        private DevExpress.XtraBars.BarManager fld_brmToolbarManager;
        private DevExpress.XtraBars.BarDockControl barDockControlTop;
        private DevExpress.XtraBars.BarDockControl barDockControlBottom;
        private DevExpress.XtraBars.BarDockControl barDockControlLeft;
        private DevExpress.XtraBars.BarDockControl barDockControlRight;
        public DevExpress.XtraBars.BarButtonItem fld_barmnbContents;
        public DevExpress.XtraBars.BarButtonItem fld_barmnbSystemInfo;
        public DevExpress.XtraBars.BarButtonItem fld_barmnbLicenses;
        public DevExpress.XtraBars.BarButtonItem fld_barmnbAbout;
        private DevExpress.XtraBars.BarButtonItem fld_barmnuOpenCompany;
        private DevExpress.XtraBars.BarButtonItem fld_barmnuCloseCompany;
        private DevExpress.XtraBars.BarButtonItem fld_barmnuLogOff;
        private DevExpress.XtraBars.BarButtonItem fld_barmnuExit;
        private DevExpress.XtraBars.BarAndDockingController barAndDockingController1;
        private DevExpress.XtraBars.Docking.DockManager dockManager;

        public DevExpress.XtraBars.Docking.ControlContainer dockPanelSearchResults_Container;
        private DevExpress.XtraBars.BarButtonItem fld_mnubarbtnSectionExplorer;
        private DevExpress.XtraBars.BarButtonItem fld_mnubarbtnSearchExplorer;
        private DevExpress.XtraBars.BarButtonItem barButtonItem1;
        public DevExpress.XtraBars.PopupMenu popupMenuToolbar;
        public DevExpress.XtraBars.Bar BarMenu;
        private DevExpress.XtraBars.BarSubItem barSubItemMenuFile;
        private DevExpress.XtraBars.BarSubItem barSubItemMenuUtility;
        private DevExpress.XtraBars.BarSubItem barSubMenuItemInfo;
        private DevExpress.XtraBars.BarSubItem barSubItem1;
        private DevExpress.XtraBars.BarSubItem barSubMenuItemExtra;
        private DevExpress.XtraBars.BarSubItem barSubMenuItemStyle;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleOffice2003;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleFlat;
        private DevExpress.XtraBars.BarCheckItem barCheckItem1;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleStyle3D;
        private DevExpress.XtraBars.BarSubItem barSubItemStyleSkin;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleSkinCaramel;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleSkinTheAsphaltWorld;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleSkinMoneyTwins;
        private DevExpress.XtraBars.BarSubItem barSubItem2;
        private DevExpress.XtraEditors.Repository.RepositoryItemTextEdit repositoryItemTextEdit1;
        private DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit repositoryItemCheckEdit1;
        private DevExpress.XtraEditors.Repository.RepositoryItemRadioGroup repositoryItemRadioGroup1;
        private DevExpress.XtraBars.BarSubItem barSubItem3;
        private DevExpress.XtraBars.BarButtonItem fld_barbtnProductInventoryInformation;
        private DevExpress.XtraBars.BarButtonItem fld_barbtnProductSerieInventoryInformation;
        private DevExpress.XtraBars.BarButtonItem fld_barbtnSummaryInformation;
        private DevExpress.XtraBars.BarButtonItem fld_barbtnSection;
        private DevExpress.XtraBars.BarButtonItem barButtonItem2;
        private DevExpress.XtraBars.BarButtonItem barButtonItem3;
        private DevExpress.XtraBars.BarStaticItem barStaticItem1;
        private DevExpress.XtraBars.Bar bar1;
        private DevExpress.XtraBars.Bar bar2;
        private DevExpress.XtraBars.Bar bar3;
        private DevExpress.XtraBars.Bar bar4;
        private DevExpress.XtraBars.Bar bar5;
        private DevExpress.XtraBars.Bar bar6;
        private DevExpress.XtraBars.Bar bar7;
        private DevExpress.XtraBars.Bar bar8;
        private DevExpress.XtraBars.Bar bar9;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleSkinLilian;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleSkiniMaginary;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleSkinBlack;
        private DevExpress.XtraBars.BarCheckItem fld_barCheckStyleSkinBlue;
        public DevExpress.XtraBars.BarCheckItem fld_barckeSearchOption;
        private DevExpress.XtraBars.BarButtonItem barButtonItem4;
        private DevExpress.XtraBars.BarStaticItem barStaticItem3;
        private DevExpress.XtraBars.BarStaticItem barStaticItem4;
        private DevExpress.XtraEditors.LabelControl fld_lblTemplateProgressText;
        public DevExpress.XtraBars.BarCheckItem fld_barckeSearchResults;
        private DevExpress.XtraTab.XtraTabControl fld_tabScreenContainer;
        private DevExpress.XtraEditors.DropDownButton fld_drdbtnCreateCriteria;
        private DevExpress.XtraEditors.PanelControl fld_pnlSearchResults;
        public DevExpress.XtraBars.Docking.DockPanel dockSearchResultsPanel;
        private DevExpress.XtraBars.PopupControlContainer fld_popCriteriaName;
        private ADCriterasGridControl fld_dgcADCriterias;
        private DevExpress.XtraBars.PopupControlContainer popupControlContainer1;

        #endregion

        #region Constructor
        public ModuleParentScreen()
        {
            //
            // Required for Windows Form Designer support
            //			            			
            InitializeComponent();
            //
            // TODO: Add any constructor code after InitializeComponent call
            //                               
            ToolbarManager.LargeImages = THSApp.ToolbarImageList;
            ToolbarManager.Images = THSApp.ToolbarImageList;
            //remove SectionManager_HieuNH_10/05/2010
            //SectionManager.SmallImages = THSApp.SectionImageList;
            //remove treelistManager_HieuNH_10/05/2010
            //treelistManager.StateImageList=THSApp.SectionImageList;
            string ScreenMaximize = String.Empty;
            countParentScreenActive = 0;
            //this.WindowState = A1CompanyConfigUtility.ScreenState;
        }
        #endregion

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ModuleParentScreen));
            this.fld_brmToolbarManager = new DevExpress.XtraBars.BarManager(this.components);
            this.BarMenu = new DevExpress.XtraBars.Bar();
            this.barSubItemMenuFile = new DevExpress.XtraBars.BarSubItem();
            this.barSubItem3 = new DevExpress.XtraBars.BarSubItem();
            this.fld_barckeSearchOption = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barckeSearchResults = new DevExpress.XtraBars.BarCheckItem();
            this.barSubItemMenuUtility = new DevExpress.XtraBars.BarSubItem();
            this.barSubMenuItemExtra = new DevExpress.XtraBars.BarSubItem();
            this.barSubMenuItemInfo = new DevExpress.XtraBars.BarSubItem();
            this.barSubMenuItemStyle = new DevExpress.XtraBars.BarSubItem();
            this.fld_barCheckStyleOffice2003 = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barCheckStyleFlat = new DevExpress.XtraBars.BarCheckItem();
            this.barCheckItem1 = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barCheckStyleStyle3D = new DevExpress.XtraBars.BarCheckItem();
            this.barSubItemStyleSkin = new DevExpress.XtraBars.BarSubItem();
            this.fld_barCheckStyleSkinCaramel = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barCheckStyleSkinMoneyTwins = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barCheckStyleSkinLilian = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barCheckStyleSkinTheAsphaltWorld = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barCheckStyleSkiniMaginary = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barCheckStyleSkinBlack = new DevExpress.XtraBars.BarCheckItem();
            this.fld_barCheckStyleSkinBlue = new DevExpress.XtraBars.BarCheckItem();
            this.barSubItem2 = new DevExpress.XtraBars.BarSubItem();
            this.barAndDockingController1 = new DevExpress.XtraBars.BarAndDockingController(this.components);
            this.barDockControlTop = new DevExpress.XtraBars.BarDockControl();
            this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
            this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl();
            this.barDockControlRight = new DevExpress.XtraBars.BarDockControl();
            this.fld_barmnbContents = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barmnbSystemInfo = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barmnbLicenses = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barmnbAbout = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barmnuOpenCompany = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barmnuCloseCompany = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barmnuLogOff = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barmnuExit = new DevExpress.XtraBars.BarButtonItem();
            this.fld_mnubarbtnSectionExplorer = new DevExpress.XtraBars.BarButtonItem();
            this.fld_mnubarbtnSearchExplorer = new DevExpress.XtraBars.BarButtonItem();
            this.barButtonItem1 = new DevExpress.XtraBars.BarButtonItem();
            this.barSubItem1 = new DevExpress.XtraBars.BarSubItem();
            this.fld_barbtnProductInventoryInformation = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barbtnProductSerieInventoryInformation = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barbtnSummaryInformation = new DevExpress.XtraBars.BarButtonItem();
            this.fld_barbtnSection = new DevExpress.XtraBars.BarButtonItem();
            this.barButtonItem2 = new DevExpress.XtraBars.BarButtonItem();
            this.barButtonItem3 = new DevExpress.XtraBars.BarButtonItem();
            this.barStaticItem1 = new DevExpress.XtraBars.BarStaticItem();
            this.barButtonItem4 = new DevExpress.XtraBars.BarButtonItem();
            this.barStaticItem3 = new DevExpress.XtraBars.BarStaticItem();
            this.barStaticItem4 = new DevExpress.XtraBars.BarStaticItem();
            this.repositoryItemTextEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
            this.repositoryItemCheckEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit();
            this.repositoryItemRadioGroup1 = new DevExpress.XtraEditors.Repository.RepositoryItemRadioGroup();
            this.dockManager = new DevExpress.XtraBars.Docking.DockManager(this.components);
            this.dockSearchResultsPanel = new DevExpress.XtraBars.Docking.DockPanel();
            this.dockPanelSearchResults_Container = new DevExpress.XtraBars.Docking.ControlContainer();
            this.fld_pnlSearchResults = new DevExpress.XtraEditors.PanelControl();
            this.fld_drdbtnCreateCriteria = new DevExpress.XtraEditors.DropDownButton();
            this.popupMenuToolbar = new DevExpress.XtraBars.PopupMenu(this.components);
            this.bar1 = new DevExpress.XtraBars.Bar();
            this.bar2 = new DevExpress.XtraBars.Bar();
            this.bar3 = new DevExpress.XtraBars.Bar();
            this.bar4 = new DevExpress.XtraBars.Bar();
            this.bar5 = new DevExpress.XtraBars.Bar();
            this.bar6 = new DevExpress.XtraBars.Bar();
            this.bar7 = new DevExpress.XtraBars.Bar();
            this.bar8 = new DevExpress.XtraBars.Bar();
            this.bar9 = new DevExpress.XtraBars.Bar();
            this.fld_lblTemplateProgressText = new DevExpress.XtraEditors.LabelControl();
            this.fld_tabScreenContainer = new DevExpress.XtraTab.XtraTabControl();
            this.popupControlContainer1 = new DevExpress.XtraBars.PopupControlContainer(this.components);
            this.fld_popCriteriaName = new DevExpress.XtraBars.PopupControlContainer(this.components);
            this.fld_dgcADCriterias = new THSERP.BaseProvider.ADCriterasGridControl();
            ((System.ComponentModel.ISupportInitialize)(this.fld_brmToolbarManager)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.barAndDockingController1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemCheckEdit1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemRadioGroup1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dockManager)).BeginInit();
            this.dockSearchResultsPanel.SuspendLayout();
            this.dockPanelSearchResults_Container.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.fld_pnlSearchResults)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.popupMenuToolbar)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.fld_tabScreenContainer)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.popupControlContainer1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.fld_popCriteriaName)).BeginInit();
            this.fld_popCriteriaName.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.fld_dgcADCriterias)).BeginInit();
            this.SuspendLayout();
            // 
            // fld_brmToolbarManager
            // 
            this.fld_brmToolbarManager.AllowCustomization = false;
            this.fld_brmToolbarManager.AllowQuickCustomization = false;
            this.fld_brmToolbarManager.Bars.AddRange(new DevExpress.XtraBars.Bar[] {
            this.BarMenu});
            this.fld_brmToolbarManager.Controller = this.barAndDockingController1;
            this.fld_brmToolbarManager.DockControls.Add(this.barDockControlTop);
            this.fld_brmToolbarManager.DockControls.Add(this.barDockControlBottom);
            this.fld_brmToolbarManager.DockControls.Add(this.barDockControlLeft);
            this.fld_brmToolbarManager.DockControls.Add(this.barDockControlRight);
            this.fld_brmToolbarManager.Form = this;
            this.fld_brmToolbarManager.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
            this.fld_barmnbContents,
            this.fld_barmnbSystemInfo,
            this.fld_barmnbLicenses,
            this.fld_barmnbAbout,
            this.fld_barmnuOpenCompany,
            this.fld_barmnuCloseCompany,
            this.fld_barmnuLogOff,
            this.fld_barmnuExit,
            this.fld_mnubarbtnSectionExplorer,
            this.fld_mnubarbtnSearchExplorer,
            this.barButtonItem1,
            this.barSubItem1,
            this.barSubItemMenuFile,
            this.barSubItemMenuUtility,
            this.barSubMenuItemInfo,
            this.barSubMenuItemExtra,
            this.barSubMenuItemStyle,
            this.fld_barCheckStyleOffice2003,
            this.fld_barCheckStyleFlat,
            this.barCheckItem1,
            this.fld_barCheckStyleStyle3D,
            this.barSubItemStyleSkin,
            this.fld_barCheckStyleSkinCaramel,
            this.fld_barCheckStyleSkinTheAsphaltWorld,
            this.fld_barCheckStyleSkinMoneyTwins,
            this.barSubItem2,
            this.barSubItem3,
            this.fld_barbtnProductInventoryInformation,
            this.fld_barbtnProductSerieInventoryInformation,
            this.fld_barbtnSummaryInformation,
            this.fld_barbtnSection,
            this.barButtonItem2,
            this.barButtonItem3,
            this.barStaticItem1,
            this.fld_barCheckStyleSkinLilian,
            this.fld_barCheckStyleSkinBlack,
            this.fld_barCheckStyleSkinBlue,
            this.fld_barCheckStyleSkiniMaginary,
            this.fld_barckeSearchOption,
            this.barButtonItem4,
            this.barStaticItem3,
            this.barStaticItem4,
            this.fld_barckeSearchResults});
            this.fld_brmToolbarManager.MainMenu = this.BarMenu;
            this.fld_brmToolbarManager.MaxItemId = 141;
            this.fld_brmToolbarManager.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
            this.repositoryItemTextEdit1,
            this.repositoryItemCheckEdit1,
            this.repositoryItemRadioGroup1});
            // 
            // BarMenu
            // 
            this.BarMenu.BarName = "Menu";
            this.BarMenu.DockCol = 0;
            this.BarMenu.DockRow = 0;
            this.BarMenu.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
            this.BarMenu.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
            new DevExpress.XtraBars.LinkPersistInfo(this.barSubItemMenuFile),
            new DevExpress.XtraBars.LinkPersistInfo(this.barSubItem3),
            new DevExpress.XtraBars.LinkPersistInfo(this.barSubItemMenuUtility),
            new DevExpress.XtraBars.LinkPersistInfo(this.barSubMenuItemExtra),
            new DevExpress.XtraBars.LinkPersistInfo(this.barSubMenuItemInfo),
            new DevExpress.XtraBars.LinkPersistInfo(this.barSubMenuItemStyle),
            new DevExpress.XtraBars.LinkPersistInfo(this.barSubItem2)});
            this.BarMenu.OptionsBar.MultiLine = true;
            this.BarMenu.OptionsBar.UseWholeRow = true;
            this.BarMenu.Text = "Menu";
            // 
            // barSubItemMenuFile
            // 
            this.barSubItemMenuFile.Caption = "File";
            this.barSubItemMenuFile.Id = 76;
            this.barSubItemMenuFile.Name = "barSubItemMenuFile";
            // 
            // barSubItem3
            // 
            this.barSubItem3.Caption = "View";
            this.barSubItem3.Id = 106;
            this.barSubItem3.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barckeSearchOption),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barckeSearchResults)});
            this.barSubItem3.Name = "barSubItem3";
            // 
            // fld_barckeSearchOption
            // 
            this.fld_barckeSearchOption.Caption = "Search Option";
            this.fld_barckeSearchOption.Id = 134;
            this.fld_barckeSearchOption.Name = "fld_barckeSearchOption";
            this.fld_barckeSearchOption.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.fld_barckeSearchOption_ItemClick);
            // 
            // fld_barckeSearchResults
            // 
            this.fld_barckeSearchResults.Caption = "Search Results";
            this.fld_barckeSearchResults.Id = 140;
            this.fld_barckeSearchResults.Name = "fld_barckeSearchResults";
            this.fld_barckeSearchResults.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.fld_barckeSearchResults_ItemClick);
            // 
            // barSubItemMenuUtility
            // 
            this.barSubItemMenuUtility.Caption = "Utility";
            this.barSubItemMenuUtility.Id = 77;
            this.barSubItemMenuUtility.Name = "barSubItemMenuUtility";
            // 
            // barSubMenuItemExtra
            // 
            this.barSubMenuItemExtra.Caption = "Extra";
            this.barSubMenuItemExtra.Id = 80;
            this.barSubMenuItemExtra.Name = "barSubMenuItemExtra";
            // 
            // barSubMenuItemInfo
            // 
            this.barSubMenuItemInfo.Caption = "Info";
            this.barSubMenuItemInfo.Id = 79;
            this.barSubMenuItemInfo.Name = "barSubMenuItemInfo";
            // 
            // barSubMenuItemStyle
            // 
            this.barSubMenuItemStyle.Caption = "Style";
            this.barSubMenuItemStyle.Id = 81;
            this.barSubMenuItemStyle.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleOffice2003),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleFlat),
            new DevExpress.XtraBars.LinkPersistInfo(this.barCheckItem1),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleStyle3D),
            new DevExpress.XtraBars.LinkPersistInfo(this.barSubItemStyleSkin)});
            this.barSubMenuItemStyle.Name = "barSubMenuItemStyle";
            // 
            // fld_barCheckStyleOffice2003
            // 
            this.fld_barCheckStyleOffice2003.Caption = "Office 2003";
            this.fld_barCheckStyleOffice2003.GroupIndex = 1;
            this.fld_barCheckStyleOffice2003.Id = 87;
            this.fld_barCheckStyleOffice2003.Name = "fld_barCheckStyleOffice2003";
            this.fld_barCheckStyleOffice2003.Tag = "Office2003";
            this.fld_barCheckStyleOffice2003.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemBarCheckStyle_ItemClick);
            // 
            // fld_barCheckStyleFlat
            // 
            this.fld_barCheckStyleFlat.Caption = "Flat";
            this.fld_barCheckStyleFlat.GroupIndex = 1;
            this.fld_barCheckStyleFlat.Id = 88;
            this.fld_barCheckStyleFlat.Name = "fld_barCheckStyleFlat";
            this.fld_barCheckStyleFlat.Tag = "Flat";
            this.fld_barCheckStyleFlat.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemBarCheckStyle_ItemClick);
            // 
            // barCheckItem1
            // 
            this.barCheckItem1.Caption = "Ultra Flat";
            this.barCheckItem1.GroupIndex = 1;
            this.barCheckItem1.Id = 89;
            this.barCheckItem1.Name = "barCheckItem1";
            this.barCheckItem1.Tag = "UltraFlat";
            this.barCheckItem1.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemBarCheckStyle_ItemClick);
            // 
            // fld_barCheckStyleStyle3D
            // 
            this.fld_barCheckStyleStyle3D.Caption = "Style 3D";
            this.fld_barCheckStyleStyle3D.GroupIndex = 1;
            this.fld_barCheckStyleStyle3D.Id = 90;
            this.fld_barCheckStyleStyle3D.Name = "fld_barCheckStyleStyle3D";
            this.fld_barCheckStyleStyle3D.Tag = "Style3D";
            this.fld_barCheckStyleStyle3D.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemBarCheckStyle_ItemClick);
            // 
            // barSubItemStyleSkin
            // 
            this.barSubItemStyleSkin.Caption = "Skin";
            this.barSubItemStyleSkin.Id = 94;
            this.barSubItemStyleSkin.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleSkinCaramel, true),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleSkinMoneyTwins),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleSkinLilian),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleSkinTheAsphaltWorld),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleSkiniMaginary),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleSkinBlack),
            new DevExpress.XtraBars.LinkPersistInfo(this.fld_barCheckStyleSkinBlue)});
            this.barSubItemStyleSkin.Name = "barSubItemStyleSkin";
            // 
            // fld_barCheckStyleSkinCaramel
            // 
            this.fld_barCheckStyleSkinCaramel.Caption = "Caramel";
            this.fld_barCheckStyleSkinCaramel.GroupIndex = 1;
            this.fld_barCheckStyleSkinCaramel.Id = 95;
            this.fld_barCheckStyleSkinCaramel.Name = "fld_barCheckStyleSkinCaramel";
            this.fld_barCheckStyleSkinCaramel.Tag = "Caramel";
            this.fld_barCheckStyleSkinCaramel.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemCheckStyleSkin_ItemClick);
            // 
            // fld_barCheckStyleSkinMoneyTwins
            // 
            this.fld_barCheckStyleSkinMoneyTwins.Caption = "Money Twins";
            this.fld_barCheckStyleSkinMoneyTwins.GroupIndex = 1;
            this.fld_barCheckStyleSkinMoneyTwins.Id = 101;
            this.fld_barCheckStyleSkinMoneyTwins.Name = "fld_barCheckStyleSkinMoneyTwins";
            this.fld_barCheckStyleSkinMoneyTwins.Tag = "Money Twins";
            this.fld_barCheckStyleSkinMoneyTwins.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemCheckStyleSkin_ItemClick);
            // 
            // fld_barCheckStyleSkinLilian
            // 
            this.fld_barCheckStyleSkinLilian.Caption = "Lilian";
            this.fld_barCheckStyleSkinLilian.GroupIndex = 1;
            this.fld_barCheckStyleSkinLilian.Id = 127;
            this.fld_barCheckStyleSkinLilian.Name = "fld_barCheckStyleSkinLilian";
            this.fld_barCheckStyleSkinLilian.Tag = "Lilian";
            this.fld_barCheckStyleSkinLilian.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemCheckStyleSkin_ItemClick);
            // 
            // fld_barCheckStyleSkinTheAsphaltWorld
            // 
            this.fld_barCheckStyleSkinTheAsphaltWorld.Caption = "The Asphalt World";
            this.fld_barCheckStyleSkinTheAsphaltWorld.GroupIndex = 1;
            this.fld_barCheckStyleSkinTheAsphaltWorld.Id = 96;
            this.fld_barCheckStyleSkinTheAsphaltWorld.Name = "fld_barCheckStyleSkinTheAsphaltWorld";
            this.fld_barCheckStyleSkinTheAsphaltWorld.Tag = "The Asphalt World";
            this.fld_barCheckStyleSkinTheAsphaltWorld.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemCheckStyleSkin_ItemClick);
            // 
            // fld_barCheckStyleSkiniMaginary
            // 
            this.fld_barCheckStyleSkiniMaginary.Caption = "iMaginary";
            this.fld_barCheckStyleSkiniMaginary.GroupIndex = 1;
            this.fld_barCheckStyleSkiniMaginary.Id = 132;
            this.fld_barCheckStyleSkiniMaginary.Name = "fld_barCheckStyleSkiniMaginary";
            this.fld_barCheckStyleSkiniMaginary.Tag = "iMaginary";
            this.fld_barCheckStyleSkiniMaginary.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemCheckStyleSkin_ItemClick);
            // 
            // fld_barCheckStyleSkinBlack
            // 
            this.fld_barCheckStyleSkinBlack.Caption = "Black";
            this.fld_barCheckStyleSkinBlack.GroupIndex = 1;
            this.fld_barCheckStyleSkinBlack.Id = 130;
            this.fld_barCheckStyleSkinBlack.Name = "fld_barCheckStyleSkinBlack";
            this.fld_barCheckStyleSkinBlack.Tag = "Black";
            this.fld_barCheckStyleSkinBlack.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemCheckStyleSkin_ItemClick);
            // 
            // fld_barCheckStyleSkinBlue
            // 
            this.fld_barCheckStyleSkinBlue.Caption = "Blue";
            this.fld_barCheckStyleSkinBlue.GroupIndex = 1;
            this.fld_barCheckStyleSkinBlue.Id = 131;
            this.fld_barCheckStyleSkinBlue.Name = "fld_barCheckStyleSkinBlue";
            this.fld_barCheckStyleSkinBlue.Tag = "Blue";
            this.fld_barCheckStyleSkinBlue.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ItemCheckStyleSkin_ItemClick);
            // 
            // barSubItem2
            // 
            this.barSubItem2.Caption = "Help";
            this.barSubItem2.Id = 102;
            this.barSubItem2.Name = "barSubItem2";
            // 
            // barAndDockingController1
            // 
            this.barAndDockingController1.PropertiesBar.AllowLinkLighting = false;
            // 
            // fld_barmnbContents
            // 
            this.fld_barmnbContents.Caption = "&Contents";
            this.fld_barmnbContents.Id = 30;
            this.fld_barmnbContents.Name = "fld_barmnbContents";
            // 
            // fld_barmnbSystemInfo
            // 
            this.fld_barmnbSystemInfo.Caption = "&System Info...";
            this.fld_barmnbSystemInfo.Id = 31;
            this.fld_barmnbSystemInfo.Name = "fld_barmnbSystemInfo";
            // 
            // fld_barmnbLicenses
            // 
            this.fld_barmnbLicenses.Caption = "&Licences";
            this.fld_barmnbLicenses.Id = 32;
            this.fld_barmnbLicenses.Name = "fld_barmnbLicenses";
            // 
            // fld_barmnbAbout
            // 
            this.fld_barmnbAbout.Caption = "&About THS";
            this.fld_barmnbAbout.Id = 33;
            this.fld_barmnbAbout.Name = "fld_barmnbAbout";
            // 
            // fld_barmnuOpenCompany
            // 
            this.fld_barmnuOpenCompany.Caption = "&Open Company";
            this.fld_barmnuOpenCompany.Id = 60;
            this.fld_barmnuOpenCompany.Name = "fld_barmnuOpenCompany";
            // 
            // fld_barmnuCloseCompany
            // 
            this.fld_barmnuCloseCompany.Caption = "&Close Company";
            this.fld_barmnuCloseCompany.Id = 61;
            this.fld_barmnuCloseCompany.Name = "fld_barmnuCloseCompany";
            // 
            // fld_barmnuLogOff
            // 
            this.fld_barmnuLogOff.Caption = "&Log Off";
            this.fld_barmnuLogOff.Id = 62;
            this.fld_barmnuLogOff.ItemShortcut = new DevExpress.XtraBars.BarShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L));
            this.fld_barmnuLogOff.Name = "fld_barmnuLogOff";
            // 
            // fld_barmnuExit
            // 
            this.fld_barmnuExit.Caption = "&Exit";
            this.fld_barmnuExit.Id = 63;
            this.fld_barmnuExit.ItemShortcut = new DevExpress.XtraBars.BarShortcut((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E));
            this.fld_barmnuExit.Name = "fld_barmnuExit";
            // 
            // fld_mnubarbtnSectionExplorer
            // 
            this.fld_mnubarbtnSectionExplorer.Caption = "Section Explorer";
            this.fld_mnubarbtnSectionExplorer.Id = 66;
            this.fld_mnubarbtnSectionExplorer.Name = "fld_mnubarbtnSectionExplorer";
            // 
            // fld_mnubarbtnSearchExplorer
            // 
            this.fld_mnubarbtnSearchExplorer.Caption = "Search Explorer";
            this.fld_mnubarbtnSearchExplorer.Id = 67;
            this.fld_mnubarbtnSearchExplorer.Name = "fld_mnubarbtnSearchExplorer";
            // 
            // barButtonItem1
            // 
            this.barButtonItem1.Caption = "Test New";
            this.barButtonItem1.Id = 70;
            this.barButtonItem1.Name = "barButtonItem1";
            // 
            // barSubItem1
            // 
            this.barSubItem1.Caption = "File";
            this.barSubItem1.Id = 75;
            this.barSubItem1.Name = "barSubItem1";
            // 
            // fld_barbtnProductInventoryInformation
            // 
            this.fld_barbtnProductInventoryInformation.Caption = "Stock Information";
            this.fld_barbtnProductInventoryInformation.Id = 107;
            this.fld_barbtnProductInventoryInformation.Name = "fld_barbtnProductInventoryInformation";
            this.fld_barbtnProductInventoryInformation.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barButtonItem2_ItemClick);
            // 
            // fld_barbtnProductSerieInventoryInformation
            // 
            this.fld_barbtnProductSerieInventoryInformation.Caption = "Serie Information";
            this.fld_barbtnProductSerieInventoryInformation.Id = 108;
            this.fld_barbtnProductSerieInventoryInformation.Name = "fld_barbtnProductSerieInventoryInformation";
            this.fld_barbtnProductSerieInventoryInformation.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barButtonItem3_ItemClick);
            // 
            // fld_barbtnSummaryInformation
            // 
            this.fld_barbtnSummaryInformation.Caption = "Search Results";
            this.fld_barbtnSummaryInformation.Id = 109;
            this.fld_barbtnSummaryInformation.Name = "fld_barbtnSummaryInformation";
            this.fld_barbtnSummaryInformation.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barButtonItem4_ItemClick);
            // 
            // fld_barbtnSection
            // 
            this.fld_barbtnSection.Caption = "Section";
            this.fld_barbtnSection.Id = 110;
            this.fld_barbtnSection.Name = "fld_barbtnSection";
            // 
            // barButtonItem2
            // 
            this.barButtonItem2.Caption = "Test";
            this.barButtonItem2.Id = 111;
            this.barButtonItem2.Name = "barButtonItem2";
            // 
            // barButtonItem3
            // 
            this.barButtonItem3.Caption = "Test1";
            this.barButtonItem3.Id = 112;
            this.barButtonItem3.Name = "barButtonItem3";
            // 
            // barStaticItem1
            // 
            this.barStaticItem1.AutoSize = DevExpress.XtraBars.BarStaticItemSize.Spring;
            this.barStaticItem1.Id = 113;
            this.barStaticItem1.Name = "barStaticItem1";
            this.barStaticItem1.TextAlignment = System.Drawing.StringAlignment.Near;
            this.barStaticItem1.Width = 32;
            // 
            // barButtonItem4
            // 
            this.barButtonItem4.Caption = "barButtonItem4";
            this.barButtonItem4.Id = 135;
            this.barButtonItem4.Name = "barButtonItem4";
            // 
            // barStaticItem3
            // 
            this.barStaticItem3.AutoSize = DevExpress.XtraBars.BarStaticItemSize.None;
            this.barStaticItem3.Id = 137;
            this.barStaticItem3.Name = "barStaticItem3";
            this.barStaticItem3.TextAlignment = System.Drawing.StringAlignment.Near;
            this.barStaticItem3.Width = 300;
            // 
            // barStaticItem4
            // 
            this.barStaticItem4.AutoSize = DevExpress.XtraBars.BarStaticItemSize.None;
            this.barStaticItem4.Id = 138;
            this.barStaticItem4.Name = "barStaticItem4";
            this.barStaticItem4.TextAlignment = System.Drawing.StringAlignment.Near;
            this.barStaticItem4.Width = 300;
            // 
            // repositoryItemTextEdit1
            // 
            this.repositoryItemTextEdit1.AutoHeight = false;
            this.repositoryItemTextEdit1.Name = "repositoryItemTextEdit1";
            // 
            // repositoryItemCheckEdit1
            // 
            this.repositoryItemCheckEdit1.AutoHeight = false;
            this.repositoryItemCheckEdit1.Name = "repositoryItemCheckEdit1";
            // 
            // repositoryItemRadioGroup1
            // 
            this.repositoryItemRadioGroup1.Name = "repositoryItemRadioGroup1";
            // 
            // dockManager
            // 
            this.dockManager.Controller = this.barAndDockingController1;
            this.dockManager.Form = this;
            this.dockManager.RootPanels.AddRange(new DevExpress.XtraBars.Docking.DockPanel[] {
            this.dockSearchResultsPanel});
            this.dockManager.TopZIndexControls.AddRange(new string[] {
            "DevExpress.XtraBars.BarDockControl",
            "System.Windows.Forms.TableLayoutPanel",
            "System.Windows.Forms.StatusBar"});
            // 
            // dockSearchResultsPanel
            // 
            this.dockSearchResultsPanel.Controls.Add(this.dockPanelSearchResults_Container);
            this.dockSearchResultsPanel.Dock = DevExpress.XtraBars.Docking.DockingStyle.Left;
            this.dockSearchResultsPanel.FloatSize = new System.Drawing.Size(200, 613);
            this.dockSearchResultsPanel.ID = new System.Guid("59031682-0182-43c1-9b04-b47fb12839ec");
            this.dockSearchResultsPanel.Location = new System.Drawing.Point(0, 24);
            this.dockSearchResultsPanel.Name = "dockSearchResultsPanel";
            this.dockSearchResultsPanel.OriginalSize = new System.Drawing.Size(250, 200);
            this.dockSearchResultsPanel.Size = new System.Drawing.Size(250, 717);
            this.dockSearchResultsPanel.Text = "Kết quả tìm kiếm";
            // 
            // dockPanelSearchResults_Container
            // 
            this.dockPanelSearchResults_Container.Controls.Add(this.fld_pnlSearchResults);
            this.dockPanelSearchResults_Container.Controls.Add(this.fld_drdbtnCreateCriteria);
            this.dockPanelSearchResults_Container.Location = new System.Drawing.Point(3, 25);
            this.dockPanelSearchResults_Container.Name = "dockPanelSearchResults_Container";
            this.dockPanelSearchResults_Container.Size = new System.Drawing.Size(244, 689);
            this.dockPanelSearchResults_Container.TabIndex = 0;
            // 
            // fld_pnlSearchResults
            // 
            this.fld_pnlSearchResults.Dock = System.Windows.Forms.DockStyle.Fill;
            this.fld_pnlSearchResults.Location = new System.Drawing.Point(0, 0);
            this.fld_pnlSearchResults.Name = "fld_pnlSearchResults";
            this.fld_pnlSearchResults.Size = new System.Drawing.Size(244, 666);
            this.fld_pnlSearchResults.TabIndex = 1;
            // 
            // fld_drdbtnCreateCriteria
            // 
            this.fld_drdbtnCreateCriteria.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.fld_drdbtnCreateCriteria.Location = new System.Drawing.Point(0, 666);
            this.fld_drdbtnCreateCriteria.MenuManager = this.fld_brmToolbarManager;
            this.fld_drdbtnCreateCriteria.Name = "fld_drdbtnCreateCriteria";
            this.fld_drdbtnCreateCriteria.Size = new System.Drawing.Size(244, 23);
            this.fld_drdbtnCreateCriteria.TabIndex = 0;
            this.fld_drdbtnCreateCriteria.Text = "Tạo lịch sử tìm kiếm";
            this.fld_drdbtnCreateCriteria.Click += new System.EventHandler(this.fld_drdbtnCreateCriteria_Click);
            // 
            // popupMenuToolbar
            // 
            this.popupMenuToolbar.Manager = this.fld_brmToolbarManager;
            this.popupMenuToolbar.Name = "popupMenuToolbar";
            // 
            // bar1
            // 
            this.bar1.BarName = "Custom 2";
            this.bar1.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar1.DockCol = 0;
            this.bar1.DockRow = 0;
            this.bar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar1.OptionsBar.AllowQuickCustomization = false;
            this.bar1.OptionsBar.DrawDragBorder = false;
            this.bar1.OptionsBar.UseWholeRow = true;
            this.bar1.Text = "Custom 2";
            // 
            // bar2
            // 
            this.bar2.BarName = "Custom 2";
            this.bar2.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar2.DockCol = 0;
            this.bar2.DockRow = 0;
            this.bar2.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar2.OptionsBar.AllowQuickCustomization = false;
            this.bar2.OptionsBar.DrawDragBorder = false;
            this.bar2.OptionsBar.UseWholeRow = true;
            this.bar2.Text = "Custom 2";
            // 
            // bar3
            // 
            this.bar3.BarName = "Custom 2";
            this.bar3.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar3.DockCol = 0;
            this.bar3.DockRow = 0;
            this.bar3.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar3.OptionsBar.AllowQuickCustomization = false;
            this.bar3.OptionsBar.DrawDragBorder = false;
            this.bar3.OptionsBar.UseWholeRow = true;
            this.bar3.Text = "Custom 2";
            // 
            // bar4
            // 
            this.bar4.BarName = "Custom 2";
            this.bar4.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar4.DockCol = 0;
            this.bar4.DockRow = 0;
            this.bar4.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar4.OptionsBar.AllowQuickCustomization = false;
            this.bar4.OptionsBar.DrawDragBorder = false;
            this.bar4.OptionsBar.UseWholeRow = true;
            this.bar4.Text = "Custom 2";
            // 
            // bar5
            // 
            this.bar5.BarName = "Custom 2";
            this.bar5.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar5.DockCol = 0;
            this.bar5.DockRow = 0;
            this.bar5.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar5.OptionsBar.AllowQuickCustomization = false;
            this.bar5.OptionsBar.DrawDragBorder = false;
            this.bar5.OptionsBar.UseWholeRow = true;
            this.bar5.Text = "Custom 2";
            // 
            // bar6
            // 
            this.bar6.BarName = "Custom 2";
            this.bar6.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar6.DockCol = 0;
            this.bar6.DockRow = 0;
            this.bar6.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar6.OptionsBar.AllowQuickCustomization = false;
            this.bar6.OptionsBar.DrawDragBorder = false;
            this.bar6.OptionsBar.UseWholeRow = true;
            this.bar6.Text = "Custom 2";
            // 
            // bar7
            // 
            this.bar7.BarName = "Custom 2";
            this.bar7.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar7.DockCol = 0;
            this.bar7.DockRow = 0;
            this.bar7.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar7.OptionsBar.AllowQuickCustomization = false;
            this.bar7.OptionsBar.DrawDragBorder = false;
            this.bar7.OptionsBar.UseWholeRow = true;
            this.bar7.Text = "Custom 2";
            // 
            // bar8
            // 
            this.bar8.BarName = "Custom 2";
            this.bar8.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar8.DockCol = 0;
            this.bar8.DockRow = 0;
            this.bar8.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar8.OptionsBar.AllowQuickCustomization = false;
            this.bar8.OptionsBar.DrawDragBorder = false;
            this.bar8.OptionsBar.UseWholeRow = true;
            this.bar8.Text = "Custom 2";
            // 
            // bar9
            // 
            this.bar9.BarName = "Custom 2";
            this.bar9.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.bar9.DockCol = 0;
            this.bar9.DockRow = 0;
            this.bar9.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.bar9.OptionsBar.AllowQuickCustomization = false;
            this.bar9.OptionsBar.DrawDragBorder = false;
            this.bar9.OptionsBar.UseWholeRow = true;
            this.bar9.Text = "Custom 2";
            // 
            // fld_lblTemplateProgressText
            // 
            this.fld_lblTemplateProgressText.Appearance.BackColor = System.Drawing.SystemColors.Control;
            this.fld_lblTemplateProgressText.Appearance.Options.UseBackColor = true;
            this.fld_lblTemplateProgressText.Location = new System.Drawing.Point(374, 698);
            this.fld_lblTemplateProgressText.Name = "fld_lblTemplateProgressText";
            this.fld_lblTemplateProgressText.Size = new System.Drawing.Size(0, 13);
            this.fld_lblTemplateProgressText.TabIndex = 19;
            this.fld_lblTemplateProgressText.Visible = false;
            // 
            // fld_tabScreenContainer
            // 
            this.fld_tabScreenContainer.Dock = System.Windows.Forms.DockStyle.Fill;
            this.fld_tabScreenContainer.Location = new System.Drawing.Point(250, 24);
            this.fld_tabScreenContainer.Name = "fld_tabScreenContainer";
            this.fld_tabScreenContainer.Size = new System.Drawing.Size(1014, 717);
            this.fld_tabScreenContainer.TabIndex = 28;
            // 
            // popupControlContainer1
            // 
            this.popupControlContainer1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
            this.popupControlContainer1.Location = new System.Drawing.Point(232, 433);
            this.popupControlContainer1.Manager = this.fld_brmToolbarManager;
            this.popupControlContainer1.Name = "popupControlContainer1";
            this.popupControlContainer1.Size = new System.Drawing.Size(537, 176);
            this.popupControlContainer1.TabIndex = 0;
            this.popupControlContainer1.Visible = false;
            // 
            // fld_popCriteriaName
            // 
            this.fld_popCriteriaName.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
            this.fld_popCriteriaName.CloseOnOuterMouseClick = false;
            this.fld_popCriteriaName.Controls.Add(this.fld_dgcADCriterias);
            this.fld_popCriteriaName.Location = new System.Drawing.Point(6, 240);
            this.fld_popCriteriaName.Name = "fld_popCriteriaName";
            this.fld_popCriteriaName.ShowCloseButton = true;
            this.fld_popCriteriaName.Size = new System.Drawing.Size(400, 150);
            this.fld_popCriteriaName.TabIndex = 0;
            this.fld_popCriteriaName.Visible = false;
            // 
            // fld_dgcADCriterias
            // 
            this.fld_dgcADCriterias.Dock = System.Windows.Forms.DockStyle.Fill;
            this.fld_dgcADCriterias.Location = new System.Drawing.Point(0, 0);
            this.fld_dgcADCriterias.MenuManager = this.fld_brmToolbarManager;
            this.fld_dgcADCriterias.Name = "fld_dgcADCriterias";
            this.fld_dgcADCriterias.Screen = null;
            this.fld_dgcADCriterias.Size = new System.Drawing.Size(400, 150);
            this.fld_dgcADCriterias.TabIndex = 0;
            this.fld_dgcADCriterias.Tag = "DC";
            this.fld_dgcADCriterias.THSComment = null;
            this.fld_dgcADCriterias.THSDataSource = "ADCriterias";
            this.fld_dgcADCriterias.THSError = null;
            this.fld_dgcADCriterias.THSFieldGroup = null;
            this.fld_dgcADCriterias.THSPrivilege = null;
            this.fld_dgcADCriterias.THSSelectType = null;
            this.fld_dgcADCriterias.THSSelectTypeValue = null;
            // 
            // ModuleParentScreen
            // 
            this.Appearance.BackColor = System.Drawing.Color.White;
            this.Appearance.ForeColor = System.Drawing.SystemColors.WindowText;
            this.Appearance.Options.UseBackColor = true;
            this.Appearance.Options.UseForeColor = true;
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
            this.ClientSize = new System.Drawing.Size(1264, 741);
            this.Controls.Add(this.fld_tabScreenContainer);
            this.Controls.Add(this.fld_lblTemplateProgressText);
            this.Controls.Add(this.dockSearchResultsPanel);
            this.Controls.Add(this.barDockControlLeft);
            this.Controls.Add(this.barDockControlRight);
            this.Controls.Add(this.barDockControlBottom);
            this.Controls.Add(this.barDockControlTop);
            this.Cursor = System.Windows.Forms.Cursors.Default;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "ModuleParentScreen";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "THS Co,. Ltd";
            this.TopMost = true;
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Load += new System.EventHandler(this.ModuleParentScreen_Load);
            this.Activated += new System.EventHandler(this.ModuleParentScreen_Activated);
            this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ModuleParentScreen_FormClosed);
            this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ModuleParentScreen_KeyUp);
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ModuleParentScreen_FormClosing);
            ((System.ComponentModel.ISupportInitialize)(this.fld_brmToolbarManager)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.barAndDockingController1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemTextEdit1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemCheckEdit1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemRadioGroup1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dockManager)).EndInit();
            this.dockSearchResultsPanel.ResumeLayout(false);
            this.dockPanelSearchResults_Container.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.fld_pnlSearchResults)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.popupMenuToolbar)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.fld_tabScreenContainer)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.popupControlContainer1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.fld_popCriteriaName)).EndInit();
            this.fld_popCriteriaName.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.fld_dgcADCriterias)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion

        #region Public Properties
        public DevExpress.XtraBars.BarManager ToolbarManager
        {
            get
            {
                return fld_brmToolbarManager;
            }

            set
            {
                fld_brmToolbarManager = value;
            }
        }

        public DevExpress.XtraEditors.LabelControl TemplateProgressText
        {
            get
            {
                return fld_lblTemplateProgressText;
            }
            set
            {
                fld_lblTemplateProgressText = value;
            }
        }

        public DevExpress.XtraTab.XtraTabControl ScreenContainer
        {
            get
            {
                return fld_tabScreenContainer;
            }
            set
            {
                fld_tabScreenContainer = value;
            }
        }

        public DevExpress.XtraEditors.PanelControl SearchResultsContainer
        {
            get { return fld_pnlSearchResults; }
            set { fld_pnlSearchResults = value; }
        }
        public DevExpress.XtraEditors.DropDownButton ButtonCreateCriteria
        {
            get { return fld_drdbtnCreateCriteria; }
            set { fld_drdbtnCreateCriteria = value; }
        }
       
        public DevExpress.XtraBars.PopupControlContainer ModuleUserCriteriaContainer
        {
            get { return fld_popCriteriaName; }
            set { fld_popCriteriaName = value; }
        }
        public ADCriterasGridControl GridModuleUserCriteria
        {
            get { return fld_dgcADCriterias; }
            set { fld_dgcADCriterias = value; }
        }
        #endregion

        #region "Init Toolbar Group"
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strToolbarGroup"></param>
        /// <returns></returns>
        /// 
        public virtual DevExpress.XtraBars.BarButtonItem[] InitToolbarButtonsForToolbar(String strToolbarGroup)
        {
            DevExpress.XtraBars.BarButtonItem[] btnToolbar = new DevExpress.XtraBars.BarButtonItem[0];
            if ((module.ModuleID > 0) && (THSApp.CurrentUserGroupInfo.ADUserGroupID > 0))
            {
                STToolbarsController objSTToolbarsController = new STToolbarsController();
                DataSet dsToolbars = objSTToolbarsController.GetSTToolbarsBySTModuleIDAndSTUserGroupIDAndSTToolbarGroup(module.ModuleID, THSApp.CurrentUserGroupInfo.ADUserGroupID, strToolbarGroup);
                //DataSet dsToolbars = objSTToolbarsController.GetSTToolbarsBySTModuleIDAndSTUserGroupIDAndSTToolbarGroup(module.ModuleID, 1, strToolbarGroup);
                if (dsToolbars.Tables.Count > 0)
                {
                    if (dsToolbars.Tables[0].Rows.Count > 0)
                    {
                        Array.Resize(ref btnToolbar, (int)dsToolbars.Tables[0].Rows.Count);
                        for (int i = 0; i < dsToolbars.Tables[0].Rows.Count; i++)
                        {
                            STToolbarsInfo objSTToolbarsInfo = (STToolbarsInfo)objSTToolbarsController.GetObjectFromDataRow(dsToolbars.Tables[0].Rows[i]);
                            btnToolbar[i] = new DevExpress.XtraBars.BarButtonItem();
                            btnToolbar[i].ButtonStyle = GetButtonStyle(objSTToolbarsInfo.STToolbarStyle);
                            btnToolbar[i].Name = objSTToolbarsInfo.STToolbarName;
                            btnToolbar[i].Tag = objSTToolbarsInfo.STToolbarTag;

                            btnToolbar[i].Caption = objSTToolbarsInfo.STToolbarCaption;
                            //if (btnToolbar[i].Caption.Length > 10)
                            //{
                            //    String strText = btnToolbar[i].Caption.Substring(0, 8) + "...";
                            //    btnToolbar[i].Caption = strText;
                            //}
                            btnToolbar[i].Description = objSTToolbarsInfo.STToolbarDesc;

                            if (btnToolbar[i].Tag.ToString() == BaseToolbar.ToolbarButtonError)
                                btnToolbar[i].Enabled = false;

                            // Visble/enable control base on privilege__28/04/2010
                            string name=objSTToolbarsInfo.STToolbarName;
                            if (!module.HasPrivilege(objSTToolbarsInfo.STToolbarPrivilege))
                                btnToolbar[i].Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
                        }
                    }
                    dsToolbars.Dispose();
                }
            }

            return btnToolbar;
        }
        /// <summary type="Toolbar">
        /// Init hot key for toolbar button
        /// </summary>
        /// <functiontype>Toolbar Function</functiontype>
        /// <param name="barButton"></param>
        private void InitHotKeyForToolbarButton(DevExpress.XtraBars.BarItem barButton)
        {
            switch (barButton.Tag.ToString())
            {
                case "New":
                    {
                        barButton.ItemShortcut = new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.F4);
                        break;
                    }
                case "Edit":
                    {
                        barButton.ItemShortcut = new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.F5);
                        break;
                    }
                case "Delete":
                    {
                        barButton.ItemShortcut = new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.F6);
                        break;
                    }
                case "Cancel":
                    {
                        barButton.ItemShortcut = new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.F7);
                        break;
                    }
                case "Save":
                    {
                        barButton.ItemShortcut = new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.F8);
                        break;
                    }
                case "Print":
                    {
                        barButton.ItemShortcut = new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.F9);
                        break;
                    }
                case "Previous":
                    {
                        barButton.ItemShortcut = new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.PageUp);
                        break;
                    }
                case "Next":
                    {
                        barButton.ItemShortcut = new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.PageDown);
                        break;
                    }
            }
        }

        /// <summary type="Toolbar">
        /// Get Button Style
        /// </summary>
        /// <param name="strStyleName">Style Name</param>
        /// <functiontype>Toolbar Function</functiontype>
        /// <returns></returns>
        public DevExpress.XtraBars.BarButtonStyle GetButtonStyle(String strStyleName)
        {
            if (strStyleName == "Check")
                return DevExpress.XtraBars.BarButtonStyle.Check;
            else if (strStyleName == "Default")
                return DevExpress.XtraBars.BarButtonStyle.Default;
            else if (strStyleName == "DropDown")
                return DevExpress.XtraBars.BarButtonStyle.DropDown;
            else return DevExpress.XtraBars.BarButtonStyle.Default;
        }
        public void SetEnableOfToolbarButton(String strToolbarGroup, String strButtonTag, bool isEnable)
        {
            DevExpress.XtraBars.BarButtonItem barbtn = GetToolbarButton(strButtonTag);
            if (barbtn != null)
                barbtn.Enabled = isEnable;
        }


        public void SetEnableOfToolbarButton(String strButtonTag, bool isEnable)
        {
            DevExpress.XtraBars.BarButtonItem barbtn = GetToolbarButton(strButtonTag);
            if (barbtn != null)
                barbtn.Enabled = isEnable;
        }


        public void SetVisibleOfToolbarGroup(String strToolbarGroup, bool isVisible)
        {
            if (ToolbarManager.Bars[strToolbarGroup] != null)
                ToolbarManager.Bars[strToolbarGroup].Visible = isVisible;
        }

        #endregion

        #region "Invalidate Toolbar Action"

        /// <summary type="InvalidateToolbar">
        /// Init Status of all buttons in toolbar Action at first time module is loaded
        /// </summary>     
        /// 
        public virtual void InitStatusForToolbarAction()
        {
            try
            {
                DevExpress.XtraBars.BarButtonItem barbtnNew = GetToolbarButton(BaseToolbar.ToolbarButtonNew);
                DevExpress.XtraBars.BarButtonItem barbtnEdit = GetToolbarButton(BaseToolbar.ToolbarButtonEdit);
                DevExpress.XtraBars.BarButtonItem barbtnDelete = GetToolbarButton(BaseToolbar.ToolbarButtonDelete);
                DevExpress.XtraBars.BarButtonItem barbtnCancel = GetToolbarButton(BaseToolbar.ToolbarButtonCancel);
                DevExpress.XtraBars.BarButtonItem barbtnSave = GetToolbarButton(BaseToolbar.ToolbarButtonSave);
                //int iSTModuleID = new STModulesController().GetObjectIDByName(module.Name);
                //int iSTUserGroupID = new ADUsersController().GetUserGroupOfUser(THSApp.CurrentUser);
                DataSet dsToolbars = new STToolbarsController().GetSTToolbarsBySTModuleIDAndSTUserGroupIDAndSTToolbarGroup(module.ModuleID, THSApp.CurrentUserGroupInfo.ADUserGroupID, BaseToolbar.ToolbarAction);
                if (dsToolbars.Tables[0].Rows.Count == 1)
                {
                    if (barbtnSave != null)
                        barbtnSave.Enabled = true;
                }
                else
                {
                    if (barbtnNew != null)
                        barbtnNew.Enabled = true;
                    if (barbtnEdit != null)
                        barbtnEdit.Enabled = true;
                    if (barbtnDelete != null)
                        barbtnDelete.Enabled = false;
                    if (barbtnCancel != null)
                        barbtnCancel.Enabled = false;
                    if (barbtnSave != null)
                        barbtnSave.Enabled = false;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("InitToolbarAction:" + e.Message);
            }
        }

        /// <summary type="InvalidateToolbar">
        /// Invalidate status of all buttons in toolbar Action after Action New is processed
        /// </summary>        
        public virtual void InvalidateToolbarAfterActionNew()
        {
            try
            {
                DevExpress.XtraBars.BarButtonItem barbtnNew = GetToolbarButton(BaseToolbar.ToolbarButtonNew);
                DevExpress.XtraBars.BarButtonItem barbtnEdit = GetToolbarButton(BaseToolbar.ToolbarButtonEdit);
                DevExpress.XtraBars.BarButtonItem barbtnDelete = GetToolbarButton(BaseToolbar.ToolbarButtonDelete);
                DevExpress.XtraBars.BarButtonItem barbtnCancel = GetToolbarButton(BaseToolbar.ToolbarButtonCancel);
                DevExpress.XtraBars.BarButtonItem barbtnSave = GetToolbarButton(BaseToolbar.ToolbarButtonSave);
                DevExpress.XtraBars.BarButtonItem barbtnDuplicate = GetToolbarButton(BaseToolbar.ToolbarButtonDuplicate);
                DevExpress.XtraBars.BarButtonItem barbtnEditTemplate = GetToolbarButton(BaseToolbar.ToolbarButtonEditTemplate);
                DevExpress.XtraBars.BarButtonItem barbtnCopy = GetToolbarButton(BaseToolbar.ToolbarButtonCopy);
                DevExpress.XtraBars.BarButtonItem barbtnPost = GetToolbarButton(BaseToolbar.ToolbarButtonPost);
                DevExpress.XtraBars.BarButtonItem barbtnComplete = GetToolbarButton(BaseToolbar.ToolbarButtonComplete);
                //diable Information dock panel_Hieunh_30/03/2010
                this.dockSearchResultsPanel.Enabled = false;
                //Remove search option on Parents Screen_HieuNH_22/05/2010
                //this.fld_pnlSearchOption.Enabled = false;
                if (barbtnCancel != null)
                    barbtnCancel.Enabled = true;
                if (barbtnSave != null)
                    barbtnSave.Enabled = true;
                if (barbtnDelete != null)
                    barbtnDelete.Enabled = false;
                if (barbtnEdit != null)
                {
                    barbtnEdit.Enabled = false;
                    barbtnEdit.Down = false;
                }

                if (barbtnDuplicate != null)
                    barbtnDuplicate.Enabled = false;

                if (barbtnEditTemplate != null)
                    barbtnEditTemplate.Enabled = false;

                if (barbtnCopy != null)
                    barbtnCopy.Enabled = false;

                if (barbtnPost != null)
                    barbtnPost.Enabled = false;

                if (barbtnNew != null)
                {
                    barbtnNew.Enabled = false;
                    barbtnNew.Down = true;
                }
                if (barbtnComplete != null)
                    barbtnComplete.Enabled = false;
            }
            catch (Exception e)
            {
                MessageBox.Show("InvalidateToolbarAfterActionNew:" + e.Message);
            }

        }

        public virtual void InvalidateToolbarAfterActionDuplicate()
        {
            try
            {
                DevExpress.XtraBars.BarButtonItem barbtnNew = GetToolbarButton(BaseToolbar.ToolbarButtonNew);
                DevExpress.XtraBars.BarButtonItem barbtnEdit = GetToolbarButton(BaseToolbar.ToolbarButtonEdit);
                DevExpress.XtraBars.BarButtonItem barbtnDelete = GetToolbarButton(BaseToolbar.ToolbarButtonDelete);
                DevExpress.XtraBars.BarButtonItem barbtnCancel = GetToolbarButton(BaseToolbar.ToolbarButtonCancel);
                DevExpress.XtraBars.BarButtonItem barbtnSave = GetToolbarButton(BaseToolbar.ToolbarButtonSave);
                DevExpress.XtraBars.BarButtonItem barbtnDuplicate = GetToolbarButton(BaseToolbar.ToolbarButtonDuplicate);
                DevExpress.XtraBars.BarButtonItem barbtnEditTemplate = GetToolbarButton(BaseToolbar.ToolbarButtonEditTemplate);
                DevExpress.XtraBars.BarButtonItem barbtnCopy = GetToolbarButton(BaseToolbar.ToolbarButtonCopy);
                DevExpress.XtraBars.BarButtonItem barbtnPost = GetToolbarButton(BaseToolbar.ToolbarButtonPost);
                DevExpress.XtraBars.BarButtonItem barbtnComplete = GetToolbarButton(BaseToolbar.ToolbarButtonComplete);
                //diable Information dock panel_Hieunh_30/03/2010
                this.dockSearchResultsPanel.Enabled = false;
                //Remove search option on Parents Screen_HieuNH_22/05/2010
                //this.fld_pnlSearchOption.Enabled = false;
                if (barbtnCancel != null)
                    barbtnCancel.Enabled = true;
                if (barbtnSave != null)
                    barbtnSave.Enabled = true;
                if (barbtnDelete != null)
                    barbtnDelete.Enabled = false;
                if (barbtnEdit != null)
                {
                    barbtnEdit.Enabled = false;
                    barbtnEdit.Down = false;
                }

                if (barbtnDuplicate != null)
                    barbtnDuplicate.Enabled = false;

                if (barbtnEditTemplate != null)
                    barbtnEditTemplate.Enabled = false;

                if (barbtnCopy != null)
                    barbtnCopy.Enabled = false;

                if (barbtnPost != null)
                    barbtnPost.Enabled = false;

                if (barbtnNew != null)
                {
                    barbtnNew.Enabled = true;
                    barbtnNew.Down = true;
                }
                if (barbtnComplete != null)
                    barbtnComplete.Enabled = false;

            }
            catch (Exception e)
            {
                MessageBox.Show("InvalidateToolbarAfterActionNew:" + e.Message);
            }

        }


        /// <summary type="InvalidateToolbar">
        /// Invalidate status of all buttons in toolbar action after Action Edit is processed
        /// </summary>    
        /// 
        public virtual void InvalidateToolbarAfterActionEdit()
        {
            try
            {
                DevExpress.XtraBars.BarButtonItem barbtnNew = GetToolbarButton(BaseToolbar.ToolbarButtonNew);
                DevExpress.XtraBars.BarButtonItem barbtnEdit = GetToolbarButton(BaseToolbar.ToolbarButtonEdit);
                DevExpress.XtraBars.BarButtonItem barbtnDelete = GetToolbarButton(BaseToolbar.ToolbarButtonDelete);
                DevExpress.XtraBars.BarButtonItem barbtnCancel = GetToolbarButton(BaseToolbar.ToolbarButtonCancel);
                DevExpress.XtraBars.BarButtonItem barbtnSave = GetToolbarButton(BaseToolbar.ToolbarButtonSave);
                DevExpress.XtraBars.BarButtonItem barbtnDuplicate = GetToolbarButton(BaseToolbar.ToolbarButtonDuplicate);
                DevExpress.XtraBars.BarButtonItem barbtnEditTemplate = GetToolbarButton(BaseToolbar.ToolbarButtonEditTemplate);
                DevExpress.XtraBars.BarButtonItem barbtnCopy = GetToolbarButton(BaseToolbar.ToolbarButtonCopy);
                DevExpress.XtraBars.BarButtonItem barbtnPost = GetToolbarButton(BaseToolbar.ToolbarButtonPost);
                DevExpress.XtraBars.BarButtonItem barbtnComplete = GetToolbarButton(BaseToolbar.ToolbarButtonComplete);
                //diable Information dock panel(search screen)_Hieunh_30/03/2010
                this.dockSearchResultsPanel.Enabled = false;
                //Remove search option on Parents Screen_HieuNH_22/05/2010
                //this.fld_pnlSearchOption.Enabled = false;
                if (barbtnNew != null)
                {
                    barbtnNew.Enabled = false;
                    barbtnNew.Down = false;
                }
                if (barbtnDuplicate != null)
                    barbtnDuplicate.Enabled = false;

                if (barbtnEdit != null)
                    barbtnEdit.Enabled = false;
                if (barbtnCancel != null)
                    barbtnCancel.Enabled = true;
                if (barbtnDelete != null)
                    barbtnDelete.Enabled = true;
                if (barbtnSave != null)
                    barbtnSave.Enabled = true;

                if (barbtnEditTemplate != null)
                {
                    barbtnEditTemplate.Enabled = false;
                }

                if (barbtnCopy != null)
                {
                    barbtnCopy.Enabled = false;
                }

                if (barbtnPost != null)
                    barbtnPost.Enabled = false;

                if (barbtnComplete != null)
                    barbtnComplete.Enabled = false;

                barbtnEdit.Down = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("InvalidateToolbarAfterActionEdit:" + e.Message);
            }

        }


        public virtual void InvalidateToolbarAfterActionEditTemplate()
        {
            try
            {
                DevExpress.XtraBars.BarButtonItem barbtnNew = GetToolbarButton(BaseToolbar.ToolbarButtonNew);
                DevExpress.XtraBars.BarButtonItem barbtnEdit = GetToolbarButton(BaseToolbar.ToolbarButtonEdit);
                DevExpress.XtraBars.BarButtonItem barbtnDelete = GetToolbarButton(BaseToolbar.ToolbarButtonDelete);
                DevExpress.XtraBars.BarButtonItem barbtnCancel = GetToolbarButton(BaseToolbar.ToolbarButtonCancel);
                DevExpress.XtraBars.BarButtonItem barbtnSave = GetToolbarButton(BaseToolbar.ToolbarButtonSave);
                DevExpress.XtraBars.BarButtonItem barbtnDuplicate = GetToolbarButton(BaseToolbar.ToolbarButtonDuplicate);
                DevExpress.XtraBars.BarButtonItem barbtnEditTemplate = GetToolbarButton(BaseToolbar.ToolbarButtonEditTemplate);

                DevExpress.XtraBars.BarButtonItem barbtnCopy = GetToolbarButton(BaseToolbar.ToolbarButtonCopy);
                DevExpress.XtraBars.BarButtonItem barbtnPost = GetToolbarButton(BaseToolbar.ToolbarButtonPost);
                DevExpress.XtraBars.BarButtonItem barbtnComplete = GetToolbarButton(BaseToolbar.ToolbarButtonComplete);
                //diable Information dock panel_Hieunh_30/03/2010
                this.dockSearchResultsPanel.Enabled = false;
                //Remove search option on Parents Screen_HieuNH_22/05/2010
                // this.fld_pnlSearchOption.Enabled = false;
                if (barbtnNew != null)
                {
                    barbtnNew.Enabled = false;
                    barbtnNew.Down = false;
                }
                if (barbtnDuplicate != null)
                    barbtnDuplicate.Enabled = false;

                if (barbtnEditTemplate != null)
                    barbtnEditTemplate.Enabled = false;

                if (barbtnCopy != null)
                    barbtnCopy.Enabled = false;

                if (barbtnEdit != null)
                    barbtnEdit.Enabled = false;
                if (barbtnCancel != null)
                    barbtnCancel.Enabled = true;
                if (barbtnDelete != null)
                    barbtnDelete.Enabled = false;
                if (barbtnSave != null)
                    barbtnSave.Enabled = true;

                if (barbtnPost != null)
                    barbtnPost.Enabled = false;
                if (barbtnComplete != null)
                    barbtnComplete.Enabled = false;

                barbtnEdit.Down = true;

            }
            catch (Exception e)
            {
                MessageBox.Show("InvalidateToolbarAfterActionEdit:" + e.Message);
            }
        }



        /// <summary type="InvalidateToolbar">
        /// Invalidate status of all button in toolbar action after action Cancel is processed
        /// </summary> 
        /// 
        public virtual void InvalidateToolbarAfterActionCancel()
        {
            try
            {
                DevExpress.XtraBars.BarButtonItem barbtnNew = GetToolbarButton(BaseToolbar.ToolbarButtonNew);
                DevExpress.XtraBars.BarButtonItem barbtnEdit = GetToolbarButton(BaseToolbar.ToolbarButtonEdit);
                DevExpress.XtraBars.BarButtonItem barbtnDelete = GetToolbarButton(BaseToolbar.ToolbarButtonDelete);
                DevExpress.XtraBars.BarButtonItem barbtnCancel = GetToolbarButton(BaseToolbar.ToolbarButtonCancel);
                DevExpress.XtraBars.BarButtonItem barbtnSave = GetToolbarButton(BaseToolbar.ToolbarButtonSave);
                DevExpress.XtraBars.BarButtonItem barbtnDuplicate = GetToolbarButton(BaseToolbar.ToolbarButtonDuplicate);
                DevExpress.XtraBars.BarButtonItem barbtnEditTemplate = GetToolbarButton(BaseToolbar.ToolbarButtonEditTemplate);
                DevExpress.XtraBars.BarButtonItem barbtnCopy = GetToolbarButton(BaseToolbar.ToolbarButtonCopy);
                DevExpress.XtraBars.BarButtonItem barbtnPost = GetToolbarButton(BaseToolbar.ToolbarButtonPost);
                DevExpress.XtraBars.BarButtonItem barbtnComplete = GetToolbarButton(BaseToolbar.ToolbarButtonComplete);
                //show information(search main screens)_Hieunh-30/03/2010
                this.dockSearchResultsPanel.Enabled = true;
                //Remove search option on Parents Screen_HieuNH_22/05/2010
                //this.fld_pnlSearchOption.Enabled = true;
                if (barbtnNew != null)
                {
                    barbtnNew.Enabled = true;
                    barbtnNew.Down = false;
                }
                if (barbtnEdit != null)
                {
                    barbtnEdit.Enabled = true;
                    barbtnEdit.Down = false;
                }

                if (barbtnEditTemplate != null)
                {
                    barbtnEditTemplate.Enabled = true;
                }

                if (barbtnDuplicate != null)
                    barbtnDuplicate.Enabled = true;

                if (barbtnCopy != null)
                    barbtnCopy.Enabled = true;

                if (barbtnDelete != null)
                    barbtnDelete.Enabled = false;
                if (barbtnCancel != null)
                    barbtnCancel.Enabled = false;
                if (barbtnSave != null)
                    barbtnSave.Enabled = false;

                if (barbtnPost != null)
                    barbtnPost.Enabled = true;
                if (barbtnComplete != null)
                    barbtnComplete.Enabled = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("InvalidateToolbarAfterActionCancel:" + e.Message);
            }
        }


        /// <summary type="InvalidateToolbar">
        /// Invalidate status of all button in toolbar Action after action Save is processed
        /// </summary> 
        /// 
        public virtual void InvalidateToolbarAfterActionSave()
        {
            try
            {
                DevExpress.XtraBars.BarButtonItem barbtnNew = GetToolbarButton(BaseToolbar.ToolbarButtonNew);
                DevExpress.XtraBars.BarButtonItem barbtnEdit = GetToolbarButton(BaseToolbar.ToolbarButtonEdit);
                DevExpress.XtraBars.BarButtonItem barbtnDelete = GetToolbarButton(BaseToolbar.ToolbarButtonDelete);
                DevExpress.XtraBars.BarButtonItem barbtnCancel = GetToolbarButton(BaseToolbar.ToolbarButtonCancel);
                DevExpress.XtraBars.BarButtonItem barbtnSave = GetToolbarButton(BaseToolbar.ToolbarButtonSave);
                DevExpress.XtraBars.BarButtonItem barbtnDuplicate = GetToolbarButton(BaseToolbar.ToolbarButtonDuplicate);
                DevExpress.XtraBars.BarButtonItem barbtnEditTemplate = GetToolbarButton(BaseToolbar.ToolbarButtonEditTemplate);
                DevExpress.XtraBars.BarButtonItem barbtnPost = GetToolbarButton(BaseToolbar.ToolbarButtonPost);

                DevExpress.XtraBars.BarButtonItem barbtnCopy = GetToolbarButton(BaseToolbar.ToolbarButtonCopy);
                DevExpress.XtraBars.BarButtonItem barbtnComplete = GetToolbarButton(BaseToolbar.ToolbarButtonComplete);
                //show information(search main screens)_Hieunh-30/03/2010
                this.dockSearchResultsPanel.Enabled = true;
                //Remove search option on Parents Screen_HieuNH_22/05/2010
                //this.fld_pnlSearchOption.Enabled = true;
                if (barbtnCancel != null)
                    barbtnCancel.Enabled = false;
                if (barbtnDelete != null)
                    barbtnDelete.Enabled = false;
                if (barbtnSave != null)
                    barbtnSave.Enabled = false;
                if (barbtnNew != null)
                {
                    barbtnNew.Enabled = true;
                    barbtnNew.Down = false;
                }
                if (barbtnEdit != null)
                {
                    barbtnEdit.Enabled = true;
                    barbtnEdit.Down = false;
                }
                if (barbtnDuplicate != null)
                {
                    barbtnDuplicate.Enabled = true;
                }

                if (barbtnEditTemplate != null)
                {
                    barbtnEditTemplate.Enabled = true;
                }

                if (barbtnCopy != null)
                    barbtnCopy.Enabled = true;
                if (barbtnPost != null)
                    barbtnPost.Enabled = true;
                if (barbtnComplete != null)
                    barbtnComplete.Enabled = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("InvalidateToolbarAfterActionSave:" + e.Message);
            }
        }


        /// <summary type="InvalidateToolbar">
        /// Invalidate status of all buttons in toolbar Action after action Delete is processed
        /// </summary> 
        /// 
        public virtual void InvalidateToolbarAfterActionDelete()
        {
            try
            {
                DevExpress.XtraBars.BarButtonItem barbtnNew = GetToolbarButton(BaseToolbar.ToolbarButtonNew);
                DevExpress.XtraBars.BarButtonItem barbtnEdit = GetToolbarButton(BaseToolbar.ToolbarButtonEdit);
                DevExpress.XtraBars.BarButtonItem barbtnDelete = GetToolbarButton(BaseToolbar.ToolbarButtonDelete);
                DevExpress.XtraBars.BarButtonItem barbtnCancel = GetToolbarButton(BaseToolbar.ToolbarButtonCancel);
                DevExpress.XtraBars.BarButtonItem barbtnSave = GetToolbarButton(BaseToolbar.ToolbarButtonSave);
                DevExpress.XtraBars.BarButtonItem barbtnEditTemplate = GetToolbarButton(BaseToolbar.ToolbarButtonEditTemplate);
                DevExpress.XtraBars.BarButtonItem barbtnDuplicate = GetToolbarButton(BaseToolbar.ToolbarButtonDuplicate);
                DevExpress.XtraBars.BarButtonItem barbtnCopy = GetToolbarButton(BaseToolbar.ToolbarButtonCopy);
                DevExpress.XtraBars.BarButtonItem barbtnComplete = GetToolbarButton(BaseToolbar.ToolbarButtonComplete);
                //show information(search main screens)_Hieunh-30/03/2010
                this.dockSearchResultsPanel.Enabled = true;
                //Remove search option on Parents Screen_HieuNH_22/05/2010
                //this.fld_pnlSearchOption.Enabled = true;
                if (barbtnNew != null)
                {
                    barbtnNew.Enabled = true;
                    barbtnNew.Down = false;
                }
                if (barbtnEdit != null)
                {
                    barbtnEdit.Enabled = true;
                    barbtnEdit.Down = false;
                }
                if (barbtnSave != null)
                    barbtnSave.Enabled = false;
                if (barbtnDelete != null)
                    barbtnDelete.Enabled = false;
                if (barbtnCancel != null)
                    barbtnCancel.Enabled = false;

                if (barbtnEditTemplate != null)
                    barbtnEditTemplate.Enabled = true;

                if (barbtnDuplicate != null)
                    barbtnDuplicate.Enabled = true;

                if (barbtnCopy != null)
                    barbtnCopy.Enabled = true;
                if (barbtnComplete != null)
                    barbtnComplete.Enabled = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("InvalidateToolbarAfterActionDelete:" + e.Message);
            }
        }


        #endregion

        #region "Generate Toolbar"
        #region "Get Module Toollbar Button"
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strToolbarGroup"></param>
        /// <param name="strToolbarTag"></param>
        /// <returns></returns>
        /// 
        public DevExpress.XtraBars.BarButtonItem GetToolbarButton(String strToolbarGroup, String strToolbarTag)
        {
            DevExpress.XtraBars.BarButtonItem barbtn = new DevExpress.XtraBars.BarButtonItem();
            STToolbarsController objSTToolbarsController = new STToolbarsController();
            STToolbarsInfo objSTToolbarsInfo = objSTToolbarsController.GetSTToolbarsBySTModuleIDAndSTUserGroupIDAndSTToolbarGroupAndSTToolbarTag(
                                                                        module.ModuleID, THSApp.CurrentUserGroupInfo.ADUserGroupID, strToolbarGroup, strToolbarTag);
            if (objSTToolbarsInfo != null)
            {
                if (!String.IsNullOrEmpty(objSTToolbarsInfo.STToolbarName))
                {
                    barbtn = (DevExpress.XtraBars.BarButtonItem)ToolbarManager.Items[objSTToolbarsInfo.STToolbarName];
                    return barbtn;
                }

            }

            return null;
        }



        public DevExpress.XtraBars.BarButtonItem GetToolbarButton(String strToolbarTag)
        {
            String strToolbarName = "fld_barbtn" + strToolbarTag;
            if (ToolbarManager.Items[strToolbarName] != null)
                return (DevExpress.XtraBars.BarButtonItem)ToolbarManager.Items[strToolbarName];
            else
                return null;
        }


        #endregion

        #region Init Menu
        public void InitMenu()
        {

        }

        private void InitBarSubMenus()
        {
            //if (THSApp.CurrentLang.Equals("ge") || THSApp.CurrentLang.Equals("default"))
            //{
            //    barSubItemMenuFile.Caption = "&Daten";
            //    barSubItemMenuUtility.Caption = "&Werkzeug";
            //    barSubMenuItemExtra.Caption = "&Extra";
            //    barSubMenuItemInfo.Caption = "&Info";
            //}
        }

        private void AddMenuItemButton(String strToolbarGroup, DevExpress.XtraBars.BarButtonItem btnButton)
        {

            if (strToolbarGroup.Equals(BaseToolbar.ToolbarAction))
                barSubItemMenuFile.AddItem(btnButton);
            else if (strToolbarGroup.Equals(BaseToolbar.ToolbarUtility))
                barSubItemMenuUtility.AddItem(btnButton);
            else if (strToolbarGroup.Equals(BaseToolbar.ToolbarExtra))
                barSubMenuItemExtra.AddItem(btnButton);
            else if (strToolbarGroup.Equals(BaseToolbar.ToolbarInfo))
                barSubMenuItemInfo.AddItem(btnButton);
        }
        #endregion

        #region "Init Module Toolbar"
        /// <summary type="InitalizeToolbar">
        /// Initialize toolbar for specific module
        /// </summary>        
        public void InitDisplayToolbar()
        {
            InitDisplayToolbarGroup(BaseToolbar.ToolbarInfo);
            InitDisplayToolbarGroup(BaseToolbar.ToolbarUtility);
            InitDisplayToolbarGroup(BaseToolbar.ToolbarExtra);
            InitDisplayToolbarGroup(BaseToolbar.ToolbarAction);

            if (!module.DisplayModus.Equals(BaseModule.cstModusNormal))
            {
                if (ToolbarManager.Bars[BaseToolbar.ToolbarAction] != null)
                {
                    ToolbarManager.Bars[BaseToolbar.ToolbarAction].Visible = false;
                }
            }
            ToolbarManager.AllowCustomization = false;
            ToolbarManager.AllowMoveBarOnToolbar = false;
            ToolbarManager.AllowShowToolbarsPopup = true;
            //if (THSApp.IsExistOpenModulesInAction())
            //{
            //    if (ToolbarManager.Bars[BaseToolbar.ToolbarAction] != null)
            //    {
            //        ToolbarManager.Bars[BaseToolbar.ToolbarAction].Visible = false;
            //    }
            //}
        }

        public void InitDisplayToolbarGroup(String strToolbarGroup)
        {
            STToolbarsController objSTToolbarsController = new STToolbarsController();
            //Get Toolbars by Module and toolbar group__28/4/2010
            //DataSet dsToolbars = objSTToolbarsController.GetSTToolbarsBySTModuleIDAndSTUserGroupIDAndSTToolbarGroup(module.ModuleID, THSApp.CurrentUserGroupInfo.ADUserGroupID, strToolbarGroup);
            DataSet dsToolbars = objSTToolbarsController.GetSTToolbarsBySTModuleIDAndSTUserGroupIDAndSTToolbarGroup(module.ModuleID, 1, strToolbarGroup);
            if (dsToolbars.Tables.Count > 0)
            {
                if (dsToolbars.Tables[0].Rows.Count > 0)
                {
                    if (popupMenuToolbar.ItemLinks.Count > 0)
                    {
                        popupMenuToolbar.ItemLinks[popupMenuToolbar.ItemLinks.Count - 1].BeginGroup = true;
                    }

                    DevExpress.XtraBars.Bar fld_toolbarGroup = new DevExpress.XtraBars.Bar(ToolbarManager);
                    fld_toolbarGroup.BarName = strToolbarGroup;
                    SetPropertiesOfToolbarGroup(ref fld_toolbarGroup, strToolbarGroup);
                    fld_toolbarGroup.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
                    fld_toolbarGroup.Text = strToolbarGroup;

                    DevExpress.XtraBars.BarButtonItem[] btnButtons = InitToolbarButtonsForToolbar(strToolbarGroup);
                    foreach (DevExpress.XtraBars.BarButtonItem btnButton in btnButtons)
                    {
                        if (THSApp.ToolbarImageList.Images.IndexOfKey(btnButton.Tag.ToString()) >= 0)
                        {
                            btnButton.LargeImageIndex = THSApp.ToolbarImageList.Images.IndexOfKey(btnButton.Tag.ToString());
                            btnButton.ImageIndex = THSApp.ToolbarImageList.Images.IndexOfKey(btnButton.Tag.ToString());

                        }
                        else
                        {
                            btnButton.LargeImageIndex = THSApp.ToolbarImageList.Images.IndexOfKey("THS");
                            btnButton.ImageIndex = THSApp.ToolbarImageList.Images.IndexOfKey("THS");
                        }

                        btnButton.Hint = strToolbarGroup;
                        btnButton.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(ToolbarButton_ItemClick);
                        DevExpress.XtraBars.BarItem barButton = new DevExpress.XtraBars.BarButtonItem();
                        barButton = btnButton;
                        //Add caption to right side barbutton Item_HieuNH_09/05/2010
                        barButton.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph;
                        InitHotKeyForToolbarButton(barButton);
                        barButton.Id = ToolbarManager.GetNewItemId();
                        ToolbarManager.Items.Add(barButton);
                        fld_toolbarGroup.AddItem(barButton);
                        if ((strToolbarGroup.Equals(BaseToolbar.ToolbarAction) || (strToolbarGroup.Equals(BaseToolbar.ToolbarUtility))))
                        {
                            popupMenuToolbar.AddItem(barButton);
                        }
                        AddMenuItemButton(strToolbarGroup, btnButton);
                    }

                    if (strToolbarGroup.Equals(BaseToolbar.ToolbarAction))
                    {
                        InitStatusForToolbarAction();
                    }
                }
            }
        }

        private void SetPropertiesOfToolbarGroup(ref DevExpress.XtraBars.Bar fld_toolbarGroup, String strToolbarGroup)
        {
            switch (strToolbarGroup)
            {
                case BaseToolbar.ToolbarAction:
                    {
                        fld_toolbarGroup.DockCol = 0;
                        fld_toolbarGroup.DockRow = 1;
                        break;
                    }
                case BaseToolbar.ToolbarUtility:
                    {
                        fld_toolbarGroup.DockCol = 1;
                        fld_toolbarGroup.DockRow = 1;
                        break;
                    }
                case BaseToolbar.ToolbarInfo:
                    {
                        fld_toolbarGroup.DockCol = 2;
                        fld_toolbarGroup.DockRow = 1;
                        fld_toolbarGroup.Offset = 800;
                        break;
                    }
                case BaseToolbar.ToolbarExtra:
                    {
                        fld_toolbarGroup.DockCol = 2;
                        fld_toolbarGroup.DockRow = 1;
                        break;
                    }


            }
        }

        /// <summary type="InitalizeToolbar">
        /// Delegate function process event ItemClick of toolbar button
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">Event Arguments</param>
        /// <THSparam name="SearchResultsControlName" type="String"></THSparam>
        public void ToolbarButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                STToolbarsController objSTToolbarsController = new STToolbarsController();
                STToolbarFunctionsController objSTToolbarFunctionsController = new STToolbarFunctionsController();
                DevExpress.XtraBars.BarItem btn = sender as DevExpress.XtraBars.BarItem;
                String strToolbarTag = e.Item.Tag.ToString();
                String strToolbarGroup = e.Item.Hint;


                STToolbarsInfo objSTToolbarsInfo = objSTToolbarsController.GetSTToolbarsBySTModuleIDAndSTUserGroupIDAndSTToolbarGroupAndSTToolbarTag(
                                                                            module.ModuleID, THSApp.CurrentUserGroupInfo.ADUserGroupID, strToolbarGroup, strToolbarTag);


                DataSet dsSTToolbarFunctions = objSTToolbarFunctionsController.GetAllDataByForeignColumn("STToolbarID", objSTToolbarsInfo.STToolbarID);
                if (dsSTToolbarFunctions.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow rowToolbarFunction in dsSTToolbarFunctions.Tables[0].Rows)
                    {
                        STToolbarFunctionsInfo objSTToolbarFunctionsInfo = (STToolbarFunctionsInfo)new STToolbarFunctionsController().GetObjectFromDataRow(rowToolbarFunction);

                        MethodInfo method = module.GetMethodInfoByMethodFullNameAndMethodClass(objSTToolbarFunctionsInfo.STToolbarFunctionName,
                                                                                        objSTToolbarFunctionsInfo.STToolbarFunctionFullName,
                                                                                        objSTToolbarFunctionsInfo.STToolbarFunctionClass);
                        //Invoke method                                
                        method.Invoke(module, module.GetMethodParameterValues(method.GetParameters(), sender, "ItemClick"));

                    }
                }
                else
                {
                    switch (strToolbarTag)
                    {
                        case BaseToolbar.ToolbarButtonNew:
                            {
                                module.ActionNew();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonEdit:
                            {
                                module.ActionEdit();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonCopy:
                            {
                                module.ActionCopy();
                                break;
                            }

                        case BaseToolbar.ToolbarButtonEditTemplate:
                            {
                                module.ActionEditTemplate();
                                break;
                            }

                        case BaseToolbar.ToolbarButtonDuplicate:
                            {
                                module.ActionDuplicate();
                                break;
                            }

                        case BaseToolbar.ToolbarButtonCancel:
                            {
                                /*Do some action */
                                module.ActionCancel();
                                break;
                            }

                        case BaseToolbar.ToolbarButtonSave:
                            {
                                /*Do some action*/
                                MethodInfo method = this.GetType().GetMethod("ToolbarButton_ItemClick", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[2] { typeof(object), typeof(DevExpress.XtraBars.ItemClickEventArgs) }, null);
                                String strSearchResultsControlName = module.GetModuleFunctionParameterValue(method.ToString(), method.DeclaringType.ToString(), "SearchResultsControlName");
                                module.ActionSave();
                                break;
                            }

                        case BaseToolbar.ToolbarButtonPost:
                            {
                                module.ActionPost();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonDelete:
                            {
                                module.ActionDelete();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonPrint:
                            {
                                module.ActionPrint();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonExport:
                            {
                                module.ActionExport();
                                break;
                            }

                        case BaseToolbar.ToolbarButtonImport:
                            {
                                module.ActionImport();
                                break;
                            }

                        case BaseToolbar.ToolbarButtonError:
                            {
                                module.ActionShowError();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonUserAudit:
                            {
                                module.ActionUserAudit();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonHistory:
                            {
                                module.ActionHistory();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonInformation:
                            {
                                break;
                            }

                        case BaseToolbar.ToolbarButtonPrevious:
                            {
                                MethodInfo method = this.GetType().GetMethod("ToolbarButton_ItemClick", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new Type[2] { typeof(object), typeof(DevExpress.XtraBars.ItemClickEventArgs) }, null);
                                String strSearchResultsControlName = module.GetModuleFunctionParameterValue(method.ToString(), method.DeclaringType.ToString(), "SearchResultsControlName");
                                module.ActionGoPrevious();
                                break;
                            }
                        case BaseToolbar.ToolbarButtonNext:
                            {
                                MethodInfo method = this.GetType().GetMethod("ToolbarButton_ItemClick", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, new Type[2] { typeof(object), typeof(DevExpress.XtraBars.ItemClickEventArgs) }, null);
                                String strSearchResultsControlName = module.GetModuleFunctionParameterValue(method.ToString(), method.DeclaringType.ToString(), "SearchResultsControlName");
                                module.ActionGoNext();
                                break;
                            }
                        //case BaseToolbar.ToolbarButtonCustomize:
                        //    {
                        //        module.ActionCustomize();
                        //        break;
                        //    }

                        //case "Refresh":
                        //    {
                        //        module.ActionRefresh();
                        //        break;
                        //    }
                    }
                }
            }


            catch (NullReferenceException)
            {
                return;
            }
        }

        public void BarButtonCloseModule_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.Close();
        }

        public void BarButtonCloseApp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            THSApp.MainScreen.Close();
        }

        #endregion

        #endregion

        #region Utility functions
        /// <summary>
        /// Show Module with module Name
        /// </summary>
        /// <param name="strModuleName">Module Name</param>
        public BaseModuleERP ShowModule(String strModuleName)
        {
            BaseModuleERP currModule = null;
            //Show module in case of the module will be show is different from Current module
            if (!module.Name.Equals(strModuleName))
            {
                //If current Module is in modus edit or new,warning message to finish task for current module before go to another module
                Cursor.Current = Cursors.WaitCursor;

                //If module will be show is in Opened Module List, get this module and show
                if (THSApp.IsOpenedModule(strModuleName))
                {
                    //remove treelistManager_HieuNH_10/05/2010
                    // ((BaseModuleERP)THSApp.OpenModules[strModuleName]).ParentScreen.SetActiveModuleByModuleName(strModuleName);
                    currModule = ((BaseModuleERP)THSApp.OpenModules[strModuleName]);
                    currModule.ParentScreen.Activate();
                }
                //if module is not in Opened Module List, create new instance and show
                else
                {
                    currModule = BaseModuleFactory.GetModule(strModuleName);
                    if (currModule != null)
                    {
                        // changes, 31/10/2008, change ordinary of these two rows
                        THSApp.AddOpenModuleToOpenModulesToolStrip(strModuleName);
                        currModule.Show();
                    }
                }

                Cursor.Current = Cursors.Default;
            }
            return currModule;
        }

        /// <summary>
        /// Populate ToolStrip Button for open module
        /// </summary>
        /// <param name="strModuleName">Name of Module will be populated to toolstrip button</param>
        /// <returns></returns>
        private ToolStripButton PopulateOpenModulesToolStripButton(String strModuleName)
        {
            String strModuleDesc = new STModuleDescriptionsController().GetDescriptionByModuleNameAndLanguageName(strModuleName, THSApp.CurrentLang);
            if (String.IsNullOrEmpty(strModuleDesc))
                strModuleDesc = strModuleName;

            ToolStripButton tsbtnOpenModules = new ToolStripButton(strModuleDesc, THSApp.SectionImageList.Images[strModuleName], OpenModulesToolStrip_Click, strModuleName);
            tsbtnOpenModules.TextImageRelation = TextImageRelation.ImageBeforeText;
            tsbtnOpenModules.CheckOnClick = true;
            return tsbtnOpenModules;
        }



        /// <summary>
        /// Set toolstripbutton of Open Module to checked
        /// </summary>
        /// <param name="tsbtnModule"></param>
        private void CheckOpenModuleToolStripButton(ToolStripButton tsbtnModule)
        {
            tsbtnModule.Checked = true;
            foreach (ToolStripButton tsbtnOpenedModule in THSApp.MainScreen.OpenModulesToolStrip.Items)
            {
                if (tsbtnOpenedModule.Name != tsbtnModule.Name)
                    tsbtnOpenedModule.Checked = false;
            }
        }
        private void CheckOpenModulesToolStripButton(String strModuleName)
        {
            foreach (ToolStripButton tsbtnOpenedModule in THSApp.MainScreen.OpenModulesToolStrip.Items)
            {
                if (tsbtnOpenedModule.Name != strModuleName)
                    tsbtnOpenedModule.Checked = false;
                else
                    tsbtnOpenedModule.Checked = true;
            }
        }

        /// <summary>
        /// Delegate function for event click of Toolstrip Button Open Module
        /// </summary>
        /// <param name="sender">sender object</param>
        /// <param name="e">Event Arugment</param>
        private void OpenModulesToolStrip_Click(object sender, EventArgs e)
        {
            ToolStripButton tsbtnModule = (ToolStripButton)sender;
            CheckOpenModuleToolStripButton(tsbtnModule);
            ShowModule(tsbtnModule.Name);
            //SetActiveGroupByModule(tsbtnModule.Name);
            //SetActiveModuleByModuleName( tsbtnModule.Name );

        }


        /// <summary>
        /// Add open module to Open Modules Tool Strip
        /// </summary>
        /// <param name="strModuleName">Name of module will be added</param>
        public void AddOpenModuleToOpenModulesToolStrip(String strModuleName)
        {
            ToolStripButton tsbtnModule = PopulateOpenModulesToolStripButton(strModuleName);
            THSApp.MainScreen.OpenModulesToolStrip.Items.Add(tsbtnModule);
            CheckOpenModuleToolStripButton(tsbtnModule);
        }


        public void AddAllOpenModuleToOpenModulesToolStrip()
        {
            //THSApp.MainScreen.OpenModulesToolStrip.Items.Clear();
            //foreach (ToolStripItem tsItem in THSApp.MainScreen.OpenModulesToolStrip.Items)
            //{
            //    ToolStripButton tsbtnModule = PopulateOpenModulesToolStripButton(tsItem.Name);
            //    THSApp.MainScreen.OpenModulesToolStrip.Items.Add(tsbtnModule);
            //}
            CheckOpenModulesToolStripButton(module.Name);
        }


        /// <summary>
        /// Check the module is opened before or not
        /// </summary>
        /// <param name="strModuleName">Name of module is checked</param>
        /// <returns>true if is opened before, otherwise return false</returns>
        public bool IsOpenedModule(String strModuleName)
        {
            return THSApp.OpenModules[strModuleName] != null;
        }

        /// <summary>
        /// Add new or update module into Opened Module list
        /// </summary>
        /// <param name="module">module will be added new or updated</param>
        public void UpdateOpenedModule(BaseModuleERP module)
        {
            if (!IsOpenedModule(module.Name))
            {
                if (!module.Name.Equals(BaseModuleERP.cstHomeModule))
                    THSApp.OpenModules.Add(module.Name, module);
            }
            else
                THSApp.OpenModules[module.Name] = module;
        }

        /// <summary>
        /// Remove module from Opened Module list
        /// </summary>
        /// <param name="module">Module will be removed</param>
        public void RemoveOpenedModule(BaseModuleERP module)
        {
            if (IsOpenedModule(module.Name))
                THSApp.OpenModules.Remove(module.Name);
        }

        /// <summary>
        /// Remove module from Opened module list
        /// </summary>
        /// <param name="strModuleName">Module name will be removed</param>
        public void RemoveOpenedModule(String strModuleName)
        {
            if (IsOpenedModule(strModuleName))
                THSApp.OpenModules.Remove(strModuleName);
        }

        #endregion

        public String GetParentScreenTextByLanguage(String strLanguageName)
        {
            STModuleDescriptionsController objSTModuleDescriptionsController = new STModuleDescriptionsController();
            String strParentScreenText = objSTModuleDescriptionsController.GetDescriptionByModuleNameAndLanguageName(module.Name, strLanguageName);
            if (String.IsNullOrEmpty(strParentScreenText))
                strParentScreenText = module.Name;
            return strParentScreenText;
        }

        private void SetScreenStyle()
        {
            ADUsersInfo objADUsersInfo = (ADUsersInfo)new ADUsersController().GetObjectByName(THSApp.CurrentUser);
            if (!String.IsNullOrEmpty(objADUsersInfo.ADUserStyle))
            {
                if (objADUsersInfo.ADUserStyle == "XP")
                {

                    this.LookAndFeel.SetStyle(DevExpress.LookAndFeel.LookAndFeelStyle.Office2003, true, true, objADUsersInfo.ADUserStyleSkin);
                    this.ToolbarManager.GetController().PaintStyleName = "WindowsXP";
                    this.ToolbarManager.GetController().ResetStyleDefaults();
                }
                else
                {
                    this.LookAndFeel.SetStyle((DevExpress.LookAndFeel.LookAndFeelStyle)Enum.Parse(typeof(DevExpress.LookAndFeel.LookAndFeelStyle), objADUsersInfo.ADUserStyle), false, false, objADUsersInfo.ADUserStyleSkin);
                    this.ToolbarManager.GetController().PaintStyleName = objADUsersInfo.ADUserStyle;

                    this.ToolbarManager.GetController().ResetStyleDefaults();
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(objADUsersInfo.ADUserStyleSkin);
                }
            }
            else
            {
                this.LookAndFeel.SetStyle(DevExpress.LookAndFeel.LookAndFeelStyle.Office2003, false, false, objADUsersInfo.ADUserStyleSkin);
                this.ToolbarManager.GetController().PaintStyleName = "Office2003";
                this.ToolbarManager.GetController().ResetStyleDefaults();
            }

        }

        private void ModuleParentScreen_Activated(object sender, EventArgs e)
        {
            base.Activate();
            this.SuspendLayout();

            //Focus active group and item in Section 
            //SetActiveModuleByModuleName(module.Name);

            //SetActiveGroupByModule(module.Name);

            //Init Open Modules on OpenModulesToolStrip
            AddAllOpenModuleToOpenModulesToolStrip();

            this.ResumeLayout(false);

            //Set Current Module
            THSApp.CurrentModule = module.Name;
            if (module.DisplayModus.Equals(BaseModule.cstModusNormal))
            {
                if (module.Toolbar.IsNullOrNoneAction())
                {
                    module.SaveUserAudit(BaseModule.cstUserAuditNothing);
                }
                else
                {
                    if (module.Toolbar.ModusAction == BaseToolbar.ModusNew)
                        module.SaveUserAudit(BaseModule.cstUserAuditNew);
                    else
                        module.SaveUserAudit(BaseModule.cstUserAuditEdit);
                }
            }
            //show current module in tooltrip_HieuNH_10/05/2010
            THSApp.MainScreen.moduleItem.Caption = module.Name;
            CheckKeyBoard(null);
        }


        public void CheckKeyBoard(KeyEventArgs e)
        {
            Keyboard kb = new Keyboard();

            if (e == null)
            {
                THSApp.MainScreen.numItem.Enabled = kb.NumLock;
                THSApp.MainScreen.capItem.Enabled = kb.CapsLock;
                THSApp.MainScreen.scrollItem.Enabled = kb.ScrollLock;
                return;
            }
            if (e.KeyCode == Keys.NumLock)
            {
                THSApp.MainScreen.numItem.Enabled = kb.NumLock;
                return;
            }
            if (e.KeyCode == Keys.CapsLock)
            {
                THSApp.MainScreen.capItem.Enabled = kb.CapsLock;
                return;
            }
            if (e.KeyCode == Keys.Scroll)
            {
                THSApp.MainScreen.scrollItem.Enabled = kb.ScrollLock;
                return;
            }

        }

        private void ModuleParentScreen_KeyUp(object sender, KeyEventArgs e)
        {

            if (e.KeyCode == Keys.NumLock || e.KeyCode == Keys.CapsLock || e.KeyCode == Keys.Scroll)
            {
                CheckKeyBoard(e);
            }
        }

        private void ModuleParentScreen_FormClosed(object sender, FormClosedEventArgs e)
        {
            //Remove Module in OpenModules
            THSApp.MainScreen.OpenModulesToolStrip.Items.RemoveByKey(module.Name);
            module.Close();
            THSApp.RemoveOpenedModule(module.Name);
            if (THSApp.CurrentUser != null)
                module.DeleteUserAudit(this.module.Name);

            //Active last open modules
            if (THSApp.MainScreen.OpenModulesToolStrip.Items.Count > 0)
            {
                // changes, 31/10/2008
                //int index = THSApp.OpenModules.Count - 1;
                int index = THSApp.MainScreen.OpenModulesToolStrip.Items.Count - 1;
                String strModuleName = THSApp.MainScreen.OpenModulesToolStrip.Items[index].Name;
                ShowModule(strModuleName);
            }
            else
            {
                THSApp.CurrentModule = String.Empty;
                THSApp.MainScreen.Focus();
                //show current module in tooltrip_HieuNH_10/05/2010
                THSApp.MainScreen.moduleItem.Caption = String.Empty;
                THSApp.MainScreen.nameItem.Caption = String.Empty;

            }
        }

        private void ModuleParentScreen_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!module.Toolbar.IsNullOrNoneAction())
            {
                DialogResult dlgResult = MessageQuestion.ShowMessageSaveBeforeExitModuleQuestion();
                if (dlgResult == DialogResult.No)
                    e.Cancel = true;
            }
        }

        private void ItemBarCheckStyle_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            String strLookAndFeelStyle = e.Item.Tag.ToString();
            THSApp.SetApplicationStyle(strLookAndFeelStyle, String.Empty);
            THSApp.SaveUserStyle(strLookAndFeelStyle, String.Empty);
        }

        //private void SetApplicationStyle(String strLookAndFeelStyle, String strLookAndFeelStyleSkin)
        //{
        //    foreach (String moduleKey in THSApp.OpenModules.Keys)
        //    {
        //        if (strLookAndFeelStyle == "XP")
        //        {
        //            BaseModuleERP module = (BaseModuleERP)THSApp.OpenModules[moduleKey];
        //            module.ParentScreen.LookAndFeel.SetStyle(DevExpress.LookAndFeel.LookAndFeelStyle.Office2003, true, true, strLookAndFeelStyleSkin);
        //            module.ParentScreen.ToolbarManager.GetController().PaintStyleName = "WindowsXP";
        //            module.ParentScreen.ToolbarManager.GetController().ResetStyleDefaults();
        //            //module.ParentScreen.SectionManager.LookAndFeel.SetStyle((DevExpress.LookAndFeel.LookAndFeelStyle)Enum.Parse(typeof(DevExpress.LookAndFeel.LookAndFeelStyle), strLookAndFeelStyle), false, false, strLookAndFeelStyle);

        //            for (int i = 0; i < module.Screens.Count; i++)
        //            {
        //                if (module.Screens[i] != null)
        //                {
        //                    module.Screens[i].LookAndFeel.SetStyle((DevExpress.LookAndFeel.LookAndFeelStyle)Enum.Parse(typeof(DevExpress.LookAndFeel.LookAndFeelStyle), "Office2003"), true, true, strLookAndFeelStyleSkin);
        //                }
        //            }

        //        }
        //        else
        //        {
        //            BaseModuleERP module = (BaseModuleERP)THSApp.OpenModules[moduleKey];
        //            module.ParentScreen.LookAndFeel.SetStyle((DevExpress.LookAndFeel.LookAndFeelStyle)Enum.Parse(typeof(DevExpress.LookAndFeel.LookAndFeelStyle), strLookAndFeelStyle), false, false, strLookAndFeelStyleSkin);
        //            module.ParentScreen.ToolbarManager.GetController().PaintStyleName = strLookAndFeelStyle;
        //            module.ParentScreen.ToolbarManager.GetController().ResetStyleDefaults();s

        //            module.ParentScreen.SectionManager.LookAndFeel.SetStyle((DevExpress.LookAndFeel.LookAndFeelStyle)Enum.Parse(typeof(DevExpress.LookAndFeel.LookAndFeelStyle), strLookAndFeelStyle), false, false, strLookAndFeelStyle);

        //            //DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(strLookAndFeelStyleSkin);


        //            for (int i = 0; i < module.Screens.Count; i++)
        //            {
        //                if (module.Screens[i] != null)
        //                {
        //                    module.Screens[i].LookAndFeel.SetStyle((DevExpress.LookAndFeel.LookAndFeelStyle)Enum.Parse(typeof(DevExpress.LookAndFeel.LookAndFeelStyle), strLookAndFeelStyle), false, false, strLookAndFeelStyleSkin);
        //                }
        //            }
        //        }
        //    }
        //}



        private void ItemCheckStyleSkin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            String strLookAndFeelStyleSkin = e.Item.Tag.ToString();
            THSApp.SetApplicationStyle("Skin", strLookAndFeelStyleSkin);
            THSApp.SaveUserStyle("Skin", strLookAndFeelStyleSkin);
        }


        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //if (dockInventoryPanel.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden)
            //{
            //    dockInventoryPanel.Show();
            //}
        }

        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //if (dockSerieInventoryPanel.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden)
            //    dockSerieInventoryPanel.Show();
        }

        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (dockSearchResultsPanel.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden)
                dockSearchResultsPanel.Show();
        }

        private void ModuleParentScreen_Load(object sender, EventArgs e)
        {

        }

        public void ModuleParentScreen_Init()
        {
            InitBarSubMenus();
            InitDisplayToolbar();

            //Init close module button 
            DevExpress.XtraBars.BarButtonItem barbtnCloseModule = new DevExpress.XtraBars.BarButtonItem();
            barbtnCloseModule.Name = "fld_barbtnCloseModule";
            barbtnCloseModule.Caption = "Close Module";
            barbtnCloseModule.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(BarButtonCloseModule_ItemClick);
            barbtnCloseModule.Id = ToolbarManager.GetNewItemId();
            ToolbarManager.Items.Add(barbtnCloseModule);
            barSubItemMenuFile.AddItem(barbtnCloseModule);
            barSubItemMenuFile.ItemLinks[barSubItemMenuFile.ItemLinks.Count - 1].BeginGroup = true;

            //Add close application button
            DevExpress.XtraBars.BarButtonItem barbtnCloseApp = new DevExpress.XtraBars.BarButtonItem();
            barbtnCloseApp.Name = "fld_barbtnCloseApp";
            barbtnCloseApp.Caption = "Exit POS";
            barbtnCloseApp.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(BarButtonCloseApp_ItemClick);
            barbtnCloseApp.Id = ToolbarManager.GetNewItemId();
            ToolbarManager.Items.Add(barbtnCloseApp);
            barSubItemMenuFile.AddItem(barbtnCloseApp);


            // InitSectionManagerByCurrentUser(THSApp.CurrentUser);

            //remove treelistManager_HieuNH_10/05/2010
            //InitRootTreeListManagerByCurrentUser(THSApp.CurrentUser);
            //SetActiveModuleByModuleName(module.Name);

            this.Text = GetParentScreenTextByLanguage(THSApp.CurrentLang);

            //SetScreenStyle();

            THSApp.MainScreen.moduleItem.Caption = THSApp.CurrentModule;
        }

        private void fld_barckeSearchOption_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //if (fld_barckeSearchOption.Checked)
            //{
            //    fld_pnlSearchOption.Visible = true;
            //}
            //else
            //{
            //    fld_pnlSearchOption.Visible = false;
            //}
        }

        public void fld_barckeSearchResults_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DevExpress.XtraBars.BarCheckItem barItem = (DevExpress.XtraBars.BarCheckItem)sender;
            if (barItem.Checked)
            {
                dockSearchResultsPanel.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
                dockSearchResultsPanel.Show();
            }
            else
            {
                dockSearchResultsPanel.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden;
                dockSearchResultsPanel.Hide();
            }
        }

        private void fld_drdbtnCreateCriteria_Click(object sender, EventArgs e)
        {
            ((BaseModuleERP)module).SearchScreen.StartPosition = FormStartPosition.CenterScreen;
            ((BaseModuleERP)module).SearchScreen.ShowDialog();
            
            
        }

    }
}
